Open LMarsiske opened 2 years ago
Great tutorial for Context API and best practices: https://www.youtube.com/watch?v=t9WmZFnE6Hg
Notes: Context API great for global state around features (related components) but is NOT to be used for state that changes frequently.
Guy recommends using Context API for global states + something like ReactQuery.
Fireship video for ReactQuery: https://www.youtube.com/watch?v=novnyCaa7To
ReactQuery Docs: https://tanstack.com/query/v4/?from=reactQueryV3&original=https://react-query-v3.tanstack.com/
Sounds like its gaining traction over Redux but I don't understand it all yet.
ReactQuery for Firestore: https://github.com/aminerol/react-query-firestore
New modern version of Redux: https://redux-toolkit.js.org/
This guy has great tutorials using it: https://www.youtube.com/watch?v=u3KlatzB7GM
Also he had a great video on replacing useState with useReduce: https://www.youtube.com/watch?v=26ogBZXeBwc
Final thoughts: Use redux-toolkit for global state mgmt across components and useReduce hook for local state.
Comprehensive redux toolkit tutorial with a shopping cart: https://www.youtube.com/watch?v=bbkBuqC1rU4
Redux: https://redux.js.org/
Context: https://reactjs.org/docs/context.html