Hello guys, this is actually my first article here on hashnode and I'm so happy you came to read what I prepared for you.
So moving over to what I want to talk about, "redux starter guide". A lot of people view redux as a hard stressing tool for state management in react. Well yeah setting up redux for your app is no doubt stressful talk more of understanding what each term means.
So today I'd be covering the terms aspect or what you need to know about redux and maybe sometime, I'll actually dive into setting your first redux app. So let's get to know what redux is.
What is Redux
Redux is an open-source JavaScript library for state management. Many consider redux as a go to because of the architecture and way it structures our app starting from your source of truth, down to the action and so. Don't worry about the source of truth and action as I'll touch those aspect.Should I consider using Redux?
Well this question is based on opinion actually. Many prefer redux while some prefer Context API with Hooks. For me I use the two depending on what I'm working on or what our project is using as it's state management.So let's get to the main section of our article and that is terms used a couple of times when setting up redux on our application and they are:
- Store
- Reducer
- Action
Redux Store
Imagine your warehouse to be a store. It holds a number of items or bring them together before use. So also redux store acts like that... Redux store brings your actions and reducers together before an action is carried out on our app. We have only one store and that is why it is called the single source of truthAction
Now also imagine you are wondering or thinking about a particular step you'd take to carry out a task, redux action or action goes same way. These are normally objects that should have two properties: The type of action and That describing what should be changed in the app state. So in summary it bears the type of task you want to carry out and then that you want to be changed using the type of action described. Making sense right?Reducer
For you to carry out an action, I'm pretty sure you've already planned on how it'll go. Reducer are functions that implement the behavior of the actions you described.They change the state of the app, based on the action type and description you gave it.
So like I said, we'd be covering the basic stuff you need in setting up redux in your react app; store, actions, and reducers. These are the basic or must know before you can get your hands dirty on redux.
In my next article, I'd show you how to set up a simple redux app with an example showing you redux in action on our application.
Thank you for sparing few minutes of your time to read my article and don't forget to share :)