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

Reducers

Actions only specify what has happened but do not specify what is the effect of that action on the application state. The reducer function specifies how the application state is changed. It is a pure function that takes the two arguments—previous state and an action—and returns the next updated state.

(previousState, action) =>newState

Things you should never do inside a reducer:

  • Modify its arguments
  • API calls and routing
  • Call other non-pure functions, for example, Date.now()

In Redux, a single object represents the application state. So, before we write any code, it is very important to think and decide the structure of the application state object.

It is recommended that we keep our state object as normalized as possible and ...

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