A dummy website using React, React-Redux, and Redux-Toolkit libraries.
A couple problems we could be facing here, if our application would continue to grow.
-
First potential issue can be our "action types" you have typos on "action types", it won't be handled by the reducer, or won't be handled correctly.
-
Second potential issue is "the amount of data" The more different pieces of state we have, the bigger our state objects get. That means we need to copy a lot of state. when we update the counter we still need to copy and keep all the other state properties, and it also means that this reducer function gets longer and longer and all of a sudden we might have an unmaintainable big Redux file.
-
Third potential issue is "state immutability"
Use "Redux Toolkit" library, which makes working with Redux more convenient and easier. Uninstall "Redux" because that is already included in "Redux toolkit"
When you create a slice, "createSlice", which has reducer functions. The "action creator" will be created automatically when you create a reducer function, They are going to have the same name as reducer functions. For example,