Fork me on GitHub
#reagent
<
2016-03-10
>
jaredly06:03:39

how do I debug reactions firing that I think shouldn’t? nvm, figured it out

edbond17:03:55

How can I setState of adapted react component?

edbond17:03:27

I use react-selectize and

clojure
(def react-multi-selectize
  (r/adapt-react-class (.-MultiSelect js/reactSelectize)))

...
:render [this]
   [react-multi-selectize { :onValueChange (fn [] ..... (.setState this #js {"search" ""}) } ]

edbond17:03:37

I don't understand how to get this of adapted component.

hugobessaa18:03:57

You can't change a component state from outside of it

cky18:03:30

…unless the component exposes a method to do so. Then you just call that. 😛

cky18:03:59

(Well, I can’t comment on whether that works with Reagent. But for React, that’s certainly the case.)

hugobessaa18:03:45

ideally you just pass props to a component

edbond18:03:49

@cky how can I call a method?

edbond18:03:07

If I can call method then I'll be able to call setState

cky18:03:20

@edbond In React, you use a ref for that. But not sure about Reagent.

seantempesta21:03:29

Hi everyone. I’ve got a quick interop question. If a regular react component is calling my reagent component, how can I get the props that were passed?

seantempesta22:03:23

holy crap, it was easier than I thought. It’s just the first argument?! I struggled with this in om.next for 2 days and it only took me 5 minutes with Reagent? I’m in love. simple_smile