Challenge: Create Redux Actions
Step 2
Focus on creating actions for managing goals. Actions are objects that describe the changes we want to make to the state. By creating actions, we can update the Redux store accordingly.
Example
Challenge
- Open the
goalAction.jsfile. - Use the correct function from the
@reduxjs/toolkitpackage to create actions. - Specify the correct action types using the target element
goaland indicate the action for each action. - To remove a goal, set the action type as
goals/removeGoal. - To add a goal, set the action type as
goals/addGoal.
- The
createActionfunction simplifies the process of creating action creators. - The action types should be descriptive and reflect the purpose of the action.
- Using string constants or variables is recommended for consistency and easier refactoring.
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 4
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
What is the correct way to use createAction from @reduxjs/toolkit?
Can you explain how to name action types for adding and removing goals?
Where should I place the new actions in my project structure?
Awesome!
Completion rate improved to 4.17
Challenge: Create Redux Actions
Swipe to show menu
Step 2
Focus on creating actions for managing goals. Actions are objects that describe the changes we want to make to the state. By creating actions, we can update the Redux store accordingly.
Example
Challenge
- Open the
goalAction.jsfile. - Use the correct function from the
@reduxjs/toolkitpackage to create actions. - Specify the correct action types using the target element
goaland indicate the action for each action. - To remove a goal, set the action type as
goals/removeGoal. - To add a goal, set the action type as
goals/addGoal.
- The
createActionfunction simplifies the process of creating action creators. - The action types should be descriptive and reflect the purpose of the action.
- Using string constants or variables is recommended for consistency and easier refactoring.
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 4