DEV Community

Discussion on: React's new Context API and Actions

Collapse
 
washingtonsteven profile image
Steven Washington

1) I would say that you could fire multiple calls to dispatch for each of your actions, or (if possible) create a new action type (a so-called "super-action") that's actually a collection of other actions.

2) Keep in mind that you action can be any sort of object. So in addition to type (which exists so you know what action you are working with), you can add in other data. An action can look like:

{
  type: "UPDATE_STRING",
  newString: "This is the new string!"
}

And then the reducer would update the state by using action.newString