Flow Control

Learn how to use middleware for flow control.

We'll cover the following...

One important usage of middleware is to control the application’s flow and logic. Let’s consider a sample user login flow:

  1. Send POST request to the server to log in
  2. Save access token in store
  3. Fetch current user’s profile information
  4. Fetch the latest notifications

Usually, our flow will begin with a LOGIN action containing the login credentials:

{
  type: 'LOGIN',
  payload: {
    email: 'info@redux-book.com',
    password: 'will-never-tell'
  }
}
...