News for hackers. Stuff that matters.
Re:Common Beginner Mistakes with React by lozenge on Sunday March 12, 2023 @05:51AM (#35118349)
To make it concrete, I think they're saying, if state "rows" depends on state "filter" and "sortOrder", people write `useEffect(() =>setRows(...), [filter, sortOrder])`.

Ie writing reactive code but relying on the React render loop to trigger reactions. The problem is that you can no longer step through your code in full and as you say, your code now mandates flushes to the DOM that are unnecessary (mid computation).

It's better to setRows at explicit places or learn and use a library like rxjs if you really need to encapsulate that complexity.

There are no comments on this comment yet.