DEV Community

Naveen Dinushka
Naveen Dinushka

Posted on

How to create an action and an action creator in Redux? (Freecodecamp notes)

Notes in QnA format

1) What is one of the core tasks of Redux?
Redux is a state management framework , so updating state is one of its core tasks and state updates are triggered by dispatching actions

2) What is an action in Redux?
An action is simply a JS object that contains information about an action event that has occurred. The Redux store receives these action objects, then updates its state accordingly. Sometimes a Redux action also carries some data. While data is optional, actions must carry a type property that specifies the 'type' of action that occurred.

*3) What's an example of Redux action? *
An action can be Logging in and data carried by that could be Login Username.

4) What does Action creators do and how to create one?
In Redux we need Action creators to accomplish an action , it is simply a JS function that returns an action.

5) Define a function named actionCreator() that returns the action object when called

Knowledge Check

1) What is one of the core tasks of Redux?
2) What is an action in Redux?
3) What's an example of Redux action?
4) What does Action creators do and how to create one?
5) Define a function named actionCreator() that returns the action object when called

Top comments (0)