reagent

2022-11-19T19:46:27.836949Z

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?

p-himik 2022-11-19T19:53:15.804959Z

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

2022-11-19T19:59:11.781989Z

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

šŸ‘ 1