February 2019
Beginner to intermediate
180 pages
4h 4m
English
BuckleScript allows us to access arbitrary JavaScript object fields using the ## syntax. We can use syntax on any Js.t type, which is a Reason type for arbitrary JavaScript objects. We'll learn more about this and other interoperability features in Chapter 4, BuckleScript, Belt, and Interoperability.
Since ReactEvent.Touch.changedTouches(event) returns a plain old JavaScript object, we can access its fields using the following:
/* App.re */ReactEvent.Touch.changedTouches(event)##item(0)##clientX
Looking in the compiled output, we see that it is what we want:
/* App.bs.js */event.changedTouches.item(0).clientX
We'll use this to add the touch feature to our menu so that users can swipe the menu closed and see the menu move as they ...
Read now
Unlock full access