rashikzaman / scrapper-react

0 stars 0 forks source link

[Technical Pick] Pros and cons of constate #3

Open olivierobert opened 2 years ago

olivierobert commented 2 years ago

The codebase uses https://github.com/diegohaz/constate for state management. There are no concerns about this specific choice, but it would be interesting why you decided to pick this over other options like Redux.

rashikzaman commented 2 years ago

constate is a library that helps write context in React in minimal effort. There are debates over the use cases of context api over redux.

Context api is used for props drilling. It helps when nested components share the same data. Redux is used for storing and reacting to global data.

Context api is very easy to implement than Redux. Since, I only have very small component tree, I opted for Context api for passing user data and keywords through the DOM tree. But If the application were huge, I'd definitely use Redux for global state management.