bucklescript-tea
bucklescript-tea copied to clipboard
[Question] How to use a React-js component?
My daughter is building a singer / singing-teacher feedback app and is using Reason. She will need to use some existing component for the audio player, and js-React has some (like https://github.com/souporserious/react-media-player) with convenient props
for things like track, current play position, play / pause control or notification callbacks etc.
Would much rather use bucklescript-tea than reason-react for the overall app. Any recommendation on how to connect her bs-tea to this react-js component? The simpler the better.
Thanks!
As long as it follows the webcomponent custom elements spec then there should be not much issue (just have to be sure the vdom stays fairly static is 'structure' (though not content). I.E. whatever you type for in the DOM in HTML (not javascript) is what you'd here too.
If, however, it's a pure javascript library, then you'll need a little bit of scaffolding to expose it from javascript to ocaml/reason (some external
declarations and such, can see the reason/bucklescript docs on how to do that in detail), then to 'mount' the element into the VDom would have to be done outside of the vdom sadly, the code is not much but it's not intuitive either (more intuitive than Elm at least). I need to finish making my Custom element node as it would be able to handle this more easily. I can try to focus on that soon if it is indeed a purely javascript library without custom-element usage. Though if it has custom-element support then I'd highly recommend using that (as it is the HTML5 webcomponent spec and what this library will be transitioning to follow in time). :-)