reagent 2022-11-19

hi all! I’m trying to use the useEffect hook in a component that takes an argument. this is what I have so far:

(defn component-with-use-effect
  [arg]
  (react/useEffect (fn []))
  [:div "arg:" (str arg)])

(defn parent-component
  [arg]
  [:f> component-with-use-effect])
However, you can see that the arg from parent-component is not getting passed to component-with-use-effect. Any advice on how to do this?

But you don't pass the arg. Have you tried using [:f> component-with-use-effect arg]?

ah ha, thanks! šŸ˜… I was trying variations like [:f> [component-with-use-effect arg]]

šŸ‘ 1