Skip to content

caiodomingues/react-redux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-Redux

This project was made for studying purposes, the code is not really the best (I could've splitted between components and folders correctly, but tried to keep everything "compact" 😅). There's nothing special visually, but you can test it here

Why?

I am interested in learning the basics (and advanced) of Redux, React-Redux and Redux Saga.

Results

When creating the counters with useReducer () and Redux, I realized:

  • The state management works differently between then, while Redux provides a global state container (like useContext()), useReducer() provides a independent local state container;
  • Redux can combine reducers into a single one, while useReducer() can't.
  • Every useReducer() provides their own dispatch function, dealying only with the actions that are specified by the reducer function consumed, while Redux provides a function that consumes any action dedicated for any reducer function.
  • I haven't implemented, but Redux does have middlewares (+ side-effects libraries like Redux Saga and Redux Thunk), while useReducer() doesn't.

Conclusion

Redux is almost a requirement for large and complex applications (used with useState() and useReducer() if needed), but using useState() for basic and smaller applications should be enough. If something more advanced is needed, you can stick to useState() + useReducer() + useContext().

Feedbacks are welcome!

About

Repository made for the study of Redux vs useReducer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published