There were some inconveniences when using Redux.
It was difficult to understand with non-intuitive logic
Readability is poor when debugging because there are empty data that is not needed.
However, I have improved the above discomfort and still use it. This is because using Redux creates patterns and it ensures high productivity and readability in application development.
The following explains the inconveniences of using Redux.
The basic Redux code is shown below.
If anyone who doesn't know Redux sees the code above, can he/she knows exactly how n increases by 1? Honestly, I didn't understand at first. I didn't understand where the arguments (state, dispatch) of, are input and what is input. I thought I should just use it like that.
I thought I lacked understanding, but when I told my co-workers that this was happening, there were quite a few people like me.
Empty state data, not needed
Suppose you implement a bulletin board with the following requirements.
A page showing all posts (I'll call it the /posts page)
A page showing detailed information (title, content, author) of the post (I will call it the /posts/:postID page)
If you use Redux, you can set InitState as below.
However,are useful only on the /posts page, and not required for the /posts/:postID page. Currently, there are only two pages, but if there are many pages like the admin application and there are few states used for one page, the empty status data will increase.
Redux has its advantages, but also its disadvantages. However, the disadvantage of having a large learning curve can be covered by learning, and empty state data that are not needed can be avoided by good state design. And if you use Redux well, you can build your application more easily. For example, the pattern that implements business logic in the container and the part that communicates with the backend is implemented in the slice module, so that other developers can code predictably, thereby ensuring high readability and productivity.