- Theory: https://redux.js.org/introduction/getting-started
- Usage with React: https://react-redux.js.org
- Diagram: https://kuanhsuh.github.io/2017/09/28/What-s-Redux-and-how-to-use-it/
- Install packages: redux, react-redux:
npm install --save redux
hoặc
yarn add redux
npm isntall --save react-redux
hoặc
yarn add react-redux
npm isntall --save --dev redux-devtools-extension
hoặc
yarn add --dev redux-devtools-extension
-
Coding:
- actions / types.js (constants)
- actions / index.js
- reducers / index.js
- components
- root reducers (store.js)
- store (store.js)
- App.js (config Provider with store)
-
Debug:
- Download tool: add react redux tool (chrome)
-
redux-thunk
- Install: npm install --save redux-thunk
- Actions: PENDING, SUCCESS, ERROR
- Async Action (axios / fetch)
- Config middleware (store.js)
-
redux-saga
- https://redux-saga.js.org/docs/introduction/BeginnerTutorial.html
- Install: npm install --save redux-saga / yarn add redux-saga
- sagas
- rootSagas