How do you clean up Redux' state? How do you clean up Redux' state? reactjs reactjs

How do you clean up Redux' state?


A few related thoughts:

  • Unless you're expecting dozens or hundreds of megabytes of data to be cached in your store, you're probably worrying about this too soon. Write your app, benchmark, and then optimize.
  • Dispatching actions to clear out portions of the store is entirely valid and reasonable.
  • My Redux addons ecosystem catalog may have some libraries listed that would be useful. In particular, the Component State and Reducer pages point to some libraries that do things like dynamically adding and removing reducers from your store, and resetting state.
  • You may also be interested in my collection of high-quality React and Redux tutorials.

Overall, how you organize your state, when you update it, and what you update it with is up to you. Redux simply provides a pattern and rules for the process of doing the updates.