Fork me on GitHub
#reagent
<
2019-08-07
>
alpox15:08:43

What is the best way to use react hooks with reagent? Many newer react libs come with react hooks and I wonder how to apply them.

alpox15:08:23

Never mind, I found I can use [:> Component] to use my component like a normal functional react component in which hooks work

staypufd22:08:07

Do you think you can post a simple example of how this works?

alpox22:08:38

I'm sorry - I already restructured to use hx instead of reagent as it fits my needs better and I need much less workarounds. As to what I did to make it work with using Component as normal react component, I remember I did something along the lines of:

(defn Component []
 (let [[state, setState] (react/useState #js{})]
  (reagent/as-element [:div .......])))

....

[:> Component]