prodo-dev / prodo

Prodo is a React framework to build apps faster.
https://docs.prodo.dev
MIT License
115 stars 5 forks source link

Use unstable_batchedUpdates to group setState #157

Closed kwohlfahrt closed 4 years ago

kwohlfahrt commented 4 years ago

Previously, react did some work immediately after setState was called. If a single action triggered state changes in many elements, this caused updates to be quite slow - up to 1000x vs Redux.

unstable_batchedUpdates is used by Redux to avoid this: https://react-redux.js.org/api/batch#references.

kwohlfahrt commented 4 years ago

@tdawes: I don't know how to actually test the performance of react rendering in an automated way. I've included the benchmark example for now so we can at least do some manual testing.

tdawes commented 4 years ago

We might want to move the benchmark examples into its own directory. examples/ should really be documentation (we should probably get rid of a few of the less useful examples).

kwohlfahrt commented 4 years ago

Agree with @tdawes in principle, but not in scope here. I'll merge when tests pass.