What is the best practice in using Redux for small projects?

Asked

Viewed 82 times

1

Good night. I am starting a project in Reactjs an ERP Web containing basic registrations of people, products, orders. I will use Redux for the benefits of state sharing between the components, but my doubt hangs over the saga. I saw examples of how to use the Redux-saga but I found that the code would end up being very verbose as can be seen below: For each module a folder with 3 files:

>person
-actions.js
-reducers.js
-sagas.js


>product
-actions.js
-reducer.js
-sagas.js

I also read about the implementation of Ducks Pattern but I could not find any example using Ducks Pattern + saga. And as I am a beginner in the language I also have doubts whether I should be using only pure Redux and leave the saga to be used in more complex applications?

  • 2

    Opinion: If the project is small, do not use Redux. It will only add unnecessary complexity. React already gives you all the primitives for efficient state management. I dare to say that Redux is only necessary in a few cases. See this article from the creator of Redux.

  • I agree, the Redux in a few cases you can later apply on a component if you feel need, do not need to create the project already with this standard.

1 answer

0

I did a good search this morning and I saw that you can do a lot with the context API + hook useContext(). I will start without Redux anyway and in case in the future it is necessary I will search again. For now thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.