February 2019
Intermediate to advanced
204 pages
4h 52m
English
Actions are simply JavaScript objects describing the changes in the state of the application. To be specific, they are payloads of information that transfer data from our application to the state. Does this not make sense to you? No problem. Let's look at an example use case. Suppose that we need to add a doctor's information to our hospital management system:
const ADD_NEW_DOCTOR_REQUEST = "ADD_NEW_DOCTOR_REQUEST"
It isn't rocket science, right? It's just a simple, constant ADD_DOCTOR_REQUEST. Now, let's create an object:
{ type: ADD_NEW_DOCTOR_REQUEST, data: { name: ‘Dr. Yoshmi Mukhiya’, age: 22, department: ‘Mental Health’, telecom: ‘99999999’ }}
This is a simple, plain JavaScript object, and it is referred to as an action. An ...
Read now
Unlock full access