Skip to Content
Serverless Web Applications with React and Firebase
book

Serverless Web Applications with React and Firebase

by Mayur Tanna, Harmeet Singh
April 2018
Intermediate to advanced content levelIntermediate to advanced
284 pages
6h 43m
English
Packt Publishing
Content preview from Serverless Web Applications with React and Firebase

Actions

As we saw at the beginning of the chapter, an action is nothing but a plain JavaScript object that describes what has happened. To change the state is to emit an action that describes what has happened. Also, for store, actions are only the source of truth or information.

Here's an example action creator.

Each action type should be defined as a constant:

const fetchSeats = rows => ({    type: GET_SEATS,    rows})

The type of an action describes the kind of the action that has occurred. If your application is large enough, you may separate out the action types as string constants to a separate module/file and use it in actions.

Now, you might be having a question—what should be the structure of my action ? We have here type and then have ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Web Applications with Firebase

Building Web Applications with Firebase

Gareth Brown
React Native in Action

React Native in Action

nader dabit, Nickie Buckner

Publisher Resources

ISBN: 9781788477413Supplemental Content