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.
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.
Can you post the actual code?
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.
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.