Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.08 KB

5.md

File metadata and controls

55 lines (40 loc) · 1.08 KB

Session 14: REDUX & SAGAS

  1. Theory: https://redux.js.org/introduction/getting-started
  2. Usage with React: https://react-redux.js.org
  3. Diagram: https://kuanhsuh.github.io/2017/09/28/What-s-Redux-and-how-to-use-it/
  4. 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
  1. 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)
  2. Debug:

    • Download tool: add react redux tool (chrome)
  3. redux-thunk

    • Install: npm install --save redux-thunk
    • Actions: PENDING, SUCCESS, ERROR
    • Async Action (axios / fetch)
    • Config middleware (store.js)
  4. redux-saga