Heya, wrote a https://code.thheller.com/blog/shadow-cljs/2025/06/27/case-study-reagent-with-macro-help.html and kinda blindly used reagent. It has been a while, so I'm kinda unsure what an idiomatic solution would look like. Anyone interested to rewrite https://github.com/thheller/wthjh-evolution/blob/main/src/main/wthjh/reagent.cljs into an idiomatic variant so I can test against that and not my weird goals?
Hey, you should try with React 18 instead. Even your initial code will run smoothly. I wouldn't recommend to use reagent with React 19 (yet).
Calling render multiple times is "incorrect", it will likely be quite slow.
When using ratom for the state, the state updates will trigger correct components to update automatically. Reaction could be further used to optimise, so that when only one item is updated in the collection, just the component for that item is rendered, vs. all the components for all items (though if the item value doesn't change it likely won't render again as the value is the same, but it will check if the value changed.)
I can create a updated version of the file later today
well the intent was to have all state and the root and render "down". the update happens from "outside", so can't have a ratom per "row"
I guess one ratom and deref at the top level then?
Depending on what do you want to test and show. But I don't think calling React render after every change is a real use case, or how it is supposed to be used. Not sure how it will work, maybe it works fine and if the component fns are the same as previously, it doesn't reinitialize the components and instead just updates the parameters. But ratom update triggers a re-render in a different way.
https://github.com/mohiji/wthjh-reagent/blob/main/src/cljs/wthjh/app.cljs this did the trick
just wanted a reference to show that the proper thing is actually fast