Defining actions

We start by defining our actions, as these will be important when defining the reducer function.

Let's define the actions now:

  1. First, we are going to need an action to allow a user to log in, by providing a username value and a password value:
{ type: 'LOGIN', username: 'Daniel Bugl', password: 'notsosecure' }
  1. Then, we are also going to need a REGISTER action, which, in our case, is going to be similar to the LOGIN action, because we did not implement any registration logic yet:
{ type: 'REGISTER', username: 'Daniel Bugl', password: 'notsosecure', passwordRepeat: 'notsosecure' }
  1. Finally, we are going to need a LOGOUT action, which is simply going to log out the currently logged-in user:
{ type: 'LOGOUT' }

Now, we have defined all the required user-related actions and we can move on to defining the reducer function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.243.184