DEV Community

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

Collapse
 
yawaramin profile image
Yawar Amin

These are, somewhat, the forbidden fruits of Reason :-) Anyway, this is a good 'tricks of the trade' guide to the working practitioner. The only things I would add, are that the React string identity trick is exactly how the actual React.string function is defined, and that Obj.magic is basically a name given to the %identity trick itself. So e.g. you could do

let jsDictToJsObj = Obj.magic;
let test = jsDictToJsObj(Js.Dict.empty());
Enter fullscreen mode Exit fullscreen mode

And you'd get var test = {};

Collapse
 
fhammerschmidt profile image
Florian Hammerschmidt

Thank you for your input, I really appreciate it.
I updated the post.