reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
flowthing 2020-11-23T10:58:33.242300Z

https://github.com/reagent-project/reagent/blob/master/doc/ReactFeatures.md#hooks says "If you need to pass RAtom state into these components, dereference them in the Reagent components and pass the value (and if needed, function to update them) as properties into the React function component." I don't quite understand what that means. Does anyone happen to have any examples handy?

p-himik 2020-11-23T11:03:12.242500Z

If you have (let [x (reagent/atom value)] ...), instead of passing just x to the relevant components, pass @x along with #(reset! x %).

flowthing 2020-11-23T11:03:41.242700Z

Ah! Thanks!

p-himik 2020-11-23T11:07:17.242900Z

Be sure to store #(reset! x %) instead of creating it each time:

cljs.user=> (= #() #())
false

flowthing 2020-11-23T11:08:39.243200Z

Right, thanks for the tip — certainly would've forgotten about that.