O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reducers for EditTask

We should also update our reducers to handle these newly introduced actions. We should do the following:

  • Expand the defaultState object, including the date, dateSelected, expanded, formattedDate, and selectedTaskObject properties
  • Add a helper function to format a date with MomentJS
  • Create a new switch case for the singleTask reducer to handle the SAVE_SELECTED_TASK_DETAILS action
  • Build a new selectedTask reducer for temporarily storing and modifying the selectedTaskObject being edited by the user
  • Extend the listOfTasks reducer to handle each of the new actions, delegating them to either the singleTask or selectedTask reducers when necessary

 

The defaultState object has gotten larger to accommodate new information ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required