r/Clojure • u/ndroock1 • Apr 13 '16
How to use an existing React.js component with Clojurescript and Reagent?
There are hundreds, if not thousands, of React.js components ready and available for use. I am looking for a way to use an existing React.js component ( without modifying the component itself ) in a Clojurescript / Reagent project. Is this possible? Is there a reference demo project? How is it done? - I have read the News 0.5 section on Reagent where the integration of React.js and Reagent is discussed but it is not entirely clear to me. Natively in Javascript using a standard React.js component would be as simple as <StandardComp/> provided JSX is used.
2
u/Savo4ka Apr 13 '16
Please look at cljsjs https://cljsjs.github.io/ Creating your own externs: https://github.com/cljsjs/packages/wiki/Creating-Externs
1
u/ClashTheBunny Apr 13 '16
This seems to be answered here:
http://stackoverflow.com/questions/28759108/use-predefine-react-component-from-reagent
Did that not answer the question? Stack overflow is designed for a question and answer format, whereas Reddit is more of a discussion forum.
2
u/dustingetz Apr 13 '16
https://github.com/prognostic-llc/reagent-json-editor/blob/master/vendor/reagent-json-editor/src/reagent_json_editor/core.cljs#L8
This project will probably build and run for you if you want a working example