A minimalistic ClojureScript interface to React.js
jmckitrick 2020-11-27T17:55:23.260800Z

In a simple reagent component using let and a local r/atom for state, what causes the component to re-render? I can’t figure out why 2 similar forms are behaving differently in this regard.

jmckitrick 2020-11-27T17:56:11.261700Z

One component is working fine, the other ‘on change’ is triggering the component to re-render as if the incoming data has changed, but from what I can see, only the local r/atom should be updating with each edit.

p-himik 2020-11-27T18:17:54.262Z

Can you post the actual code?

jmckitrick 2020-11-27T20:04:14.262200Z

It’s too unwieldy, but I appreciate the offer. I found wrapping the hiccup in a fn and returning that seems to have solved the issue, though. Not sure why the already working component did not need that approach.

Lu 2020-11-27T21:21:41.266400Z

There’s a r/with-let function that allows you to define your ratom without needing a fn wrapping. If you define your ratom in a let of a simple reagent component, then the ratom can’t hold any useful value because it gets re-defined along with the rendering of its component.