DEV Community

Discussion on: Reason(React) Best Practices - Part 1

Collapse
 
idkjs profile image
Alain

In your BetterString example, how do we know which includes function we are accessing? In the examples before that you call Js.String and Js.String2. Which is being used in BetterString?

Thanks for sharing this post. Very useful.

Collapse
 
fhammerschmidt profile image
Florian Hammerschmidt • Edited

If you look up [@bs.send] in the Bucklescript docs , you see that it can be used for object methods such as Array.prototype.map() or String.prototype.includes(). Thus, that is all you need for using the internal JS methods on all available JS prototypes.

Check out how it works in Reason Try!

Many thanks for your feedback!

Collapse
 
idkjs profile image
Alain

Danka, sir. Also missed this link github.com/moroshko/bs-blabla at the bottom of those docs. Thanks for sending me back there.