Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Redux The State Management

The Redux The State Management

Sastra Nababan

June 22, 2017
Tweet

More Decks by Sastra Nababan

Other Decks in Programming

Transcript

  1. What is Redux ? Predictable state container for Javascript Apps

    ✓ State Management ✓ State Container ✓ Data Binding Also known as frontend javascript library for :
  2. State is….. Memory/Space to hold your app information ✓ Data

    ✓ Communication ✓ Action ✓ Session ✓ Location
  3. Server Client Send Request Process & Rendering 1 3 2

    Server Send Rendered Page Client Most of your app state stay here Server Side Rendering
  4. Server Client Send Request Process & Rendering 1 3 2

    Server Send Data Client Most of your app state stay here Client Side Rendering Now your state lives here too 4 Client Rendering
  5. How to learn Redux ? ✓ Understand the big picture

    ✓ Get familiar with basic functional programming ‣ Pure Function ‣ Filter ‣ Map ‣ Reduce ‣ Compose ‣ Immutability
  6. When to use Redux ? If you aren't sure if

    you need it, you don't need it. - Pete Hunt I would like to amend this: don't use Redux until you have problems with vanilla React.
 - Dan Abramov “ “ Today.
 - Sastra Nababan “
  7. Redux Principle 1 of 3 Single source of truth It’s

    called store. Whole application state stored here
  8. Redux Principle 2 of 3 State is read only The

    only way to change the state is to emit an action
  9. Redux Principle 3 of 3 Changes are made with pure

    functions The only way to change the state is to emit an action
  10. Middleware The moment point between dispatching an action & reducer

    Components in app Actions Store Reducer store.dispatch(action) Middleware • logging • crash reporting • asynchronous API • routing • etc
  11. Redux Persist How to Store data locally ? ✓ HTML5

    Local Storage ✓ redux-persist ✓ redux-storage
  12. /,