February 2019
Intermediate to advanced
204 pages
4h 52m
English
JavaScript functions that take some arguments and return actions are action creators. Let's look at an action creator function for adding a new doctor to the application:
function addNewDoctor(data) { return { type: ADD_NEW_DOCTOR_REQUEST, data };}
Now, you can think of a function that you might need for deleting a record, as follows:
function deleteDoctor(identifier) { return { type: "DELETE_DOCTOR_REQUEST", identifier };}
Before we move on to reducers, let's make one more action creator for authentication. Generally, to authenticate, we use an email and password. So, in order to authenticate (or deauthenticate) we need to define actions. Please note that the actions that we define will be used in our project for a hospital ...
Read now
Unlock full access