javascript - What are differences between redux, react-redux, redux-thunk? -


i using react + flux. our team planning move flux redux. redux confusing me coming flux world. in flux control flow is simple components -> actions -> store , store updates components. simple , clear.

but in redux confusing. there no store here, yes there examples without using store. went through several tutorials, seems has own style of implementation. using containers , not. (i don't know containers concept , not able understand mapstatetoprops, mapdispatchtoprops does).

  1. can explain how control flow happens in redux ?
  2. what roles of components/containers/actions/action creators/store in redux ?
  3. difference between redux/react-redux/redux-thunk/any others ??
  4. it helpful if can post links simple , precise redux tutorials.

  1. can explain how control flow happens in redux ? redux has (always) single store.
  1. whenever want replace state in store, dispatch action.

  2. the action caught 1 or more reducers.

  3. the reducer/s create new state combines old state, , dispatched action.

  4. the store subscribers notified there new state.

  1. what roles of components/containers/actions/action creators/store in redux ?
  • store - holds state, , when new action arrives runs dispatch -> middleware -> reducers pipeline, , notifies subscribers when state replaced new one.

  • components - dumb view parts not aware of state directly. know presentational components.

  • containers - pieces of view aware of state using react-redux. known smart components, , higher order components


note containers / smart components vs. dumb components way structure app.


  • actions - same flux - command pattern type , payload.

  • action creators - dry way of creating actions (not strictly necessary)

  1. difference between redux/react-redux/redux-thunk/any others ?
  • redux - flux flow single store, can used in whatever enviroment including vanilla js, react, angular 1/2, etc...

  • react-redux - bindings between redux , react, creates containers (smart components) listen store's state changes, prepare props , rerender presentational (dumb) components.

  • redux-thunk - middleware allows write action creators return function instead of action. thunk can used delay dispatch of action, or dispatch if condition met. used async calls api, dispatch action on success / failure.

  1. it helpful if can post links simple , precise redux tutorials.

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -