In the register component of my APP, the state is stored in a redux slice. After the user registers, this component will never be rendered again and thus the memory in its redux slice should be freed up for performance.
How can this be done?
In the register component of my APP, the state is stored in a redux slice. After the user registers, this component will never be rendered again and thus the memory in its redux slice should be freed up for performance.
How can this be done?
The performance gain from freeing up a tiny bit of memory is negligible if even measurable, don't bother.
Yes you can remove / add dynamically a slice of the state with redux, this is usually done for code splitting reasons
You can follow this steps to achieve it: https://redux.js.org/usage/code-splitting
I agree with @timotgl note, based on what you have in this slice this is negligible
Redux is generally used for global state. What you are describing is local state, and should probably be moved out of redux, and into local component state. You could keep your reducer, actions, and selectors, and just refactor them into a call to React.useReducer
instead of redux.