Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to use a React-js component? #92

Open
desmond-dsouza opened this issue Jul 29, 2018 · 1 comment
Open

[Question] How to use a React-js component? #92

desmond-dsouza opened this issue Jul 29, 2018 · 1 comment

Comments

@desmond-dsouza
Copy link

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!

@OvermindDL1
Copy link
Owner

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). :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants