Fork me on GitHub
#reagent
<
2015-10-08
>
jstaffans15:10:55

If I want to leverage pre-existing React components (like for example https://github.com/azmenak/react-stripe-checkout), how do I go about getting Reagent to render it ?

mccraigmccraig15:10:04

jstaffans: reagent.core/adapt-react-class

jstaffans16:10:16

mccraigmccraig: thanks for the hint. But I assume that Reagent has to "know" about the component when I apply adapt-react-class. In JavaScript, I would install the component with npm and do something like var Checkout = require('react-stripe-checkout') in my code

jstaffans16:10:36

I'm not sure how to include the component in my project in the first place

mccraigmccraig16:10:09

@jstaffans: ha, i've got no idea about that - i've only worked with components with globally visible names and no need to mess around with commonjs or requirejs or such things

jstaffans16:10:44

so how do you achieve those globally visible names?

jstaffans16:10:49

I guess I could load the component via a <script> tag ..

mccraigmccraig16:10:58

react addons already have them... otherwise if you've got something wrapped in some module structure i guess you'll have to write some js which includes them and stuffs a reference somewhere globally visible

mccraigmccraig16:10:45

you have to be careful with <script> tags - you many need an externs file for use with advanced compilation - https://github.com/clojure/clojurescript/wiki/Compiler-Options#externs

mccraigmccraig16:10:43

@jstaffans: if you are lucky the lib you need will already be here - http://cljsjs.github.io/ - and you can include it from clojars

jstaffans16:10:58

I was just checking that out .. maybe I can package it myself

martinklepsch16:10:58

Looking at the source it might also be an option to just make an equivalent component in cljs?

jstaffans16:10:53

martinklepsch: unfortunately it's a rather big and complicated one

jstaffans16:10:37

(not the one I used as an example above)

sdegutis21:10:16

What's the best way to handle text fields in Reagent?