Action :
An action is a plain object that describes the intention to cause change with a type property.
It must have a type property which tells what type of action is being performed.
Actions have a type and an optional payload.
The command for action is
Ex :
return {
type: 'ITEMS_REQUEST', //action type
isLoading: true //payload information
}
Type: The type of action being sent. Compare it to the subject of an email.
Payloads :The contents/message of an action. Compare it to the message of an email.
Action Creators:
An action creator is simply a function, that just returns an action.
or
Actions are objects created and returned by functions called action creators that live in a directory called actions
Action creators are connected to a particular component in a way that the component can
call them through the props.
After the component calls an action, the action is dispatched
(or sent) to the reducer and the reducer makes changes to the application state based on the action.
Ex :
export const turnTitleGreen = () => {
return {
type: TURN_TITLE_GREEN
}
}