How it works...

We can summarize our application like the following to understand how it works:

  1. Action types SET_MEAL and SET_TIME were defined.
  2. Two action creators were defined:
    1. setMeal which generates an action with the SET_MEAL action type and a kindOfMeal property with the provided argument
    2. setTime which generates an action with the SET_TIME action type and a time property with the provided argument
  1. A reducer function was defined:
    1. For the action type SET_MEAL, computes a new state with a new kindOfMeal property
    2. For the action type SET_TIME, computes a new state with a new time property
  1. We defined a function that will get called when the state tree changes. Inside the function, we updated the view according to the new state.
  2. A dispatch function was defined that calls the reducer function providing the previous state and an action object to generate a new state.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.53.112