Fork me on GitHub
#reagent
<
2017-02-25
>
andnils14:02:47

I’m having issues with adding 3rd party js/react-components to my reagent-app. I’ve done a (:require [cljsjs.react-datepicker]), but I don’t know how to use it...

andnils14:02:18

(defn my-component []  [:div  [js/DatePicker]]) 

andnils14:02:43

I noticed that I actually got a hint in the console: "Warning: Using native React classes directly in Hiccup forms is not supported. Use create-element or adapt-react-class instead"

metametadata14:02:53

@andnils try this: (defn my-component [] [:div [:> js/DatePicker]])

andnils14:02:27

@metametadata thx - that worked!

metametadata14:02:59

great! for convenience you can also extract it and use as the plain reagent component:

(def date-picker (r/adapt-react-class js/DatePicker))
; ...
(defn my-component []  [:div [date-picker]])

Pablo Fernandez19:02:08

What's the difference between render and reagent-render in create-class?

gadfly36119:02:56

Note that component-function is now reagent-render

Pablo Fernandez23:02:43

But I need access to the component in the on-update. How do I get that?