Actions and Action Creators in Redux — State Management Flow
2 min readJul 11, 2021
In order to be a pro at front-end development using React, a state management framework called Redux is an essential component in helping you manage global state. See what I did there? #dadjokesInCoding Below are some incredible concepts that can help you dominate your front-end game. Check them out!
- Action = object that tells your reducer what you’re trying to do and what info it needs to do that, what your reducer is operating on and using it to help return new state
- Reducer = taking in state and that action, depending on the type, its gonna tell it what to do
- for example: update some stuff in state, => hey we’re loading now we’re going out and getting them now,
- or do we already have them already and now we’re adding them into state
- To hit your reducer = you need dispatching functions =which we call = action creators
- Action creators = action object creator function
- Thunk = lets you return a function from your action creator
- By default in redux = you can only return actions or objects from your object creators
- Making a fetch call= process that takes some amount of time with redux = you get into pattern where you return a function that takes in dispatch function as an argument