Fork me on GitHub

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.


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


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


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]