Redux is a state management tool for React. Redux Toolkit simplifies the process of working with Redux
It has three parts:
- Are objects that are used to send data to the Redux Store
- It usually contains two properties
{
payload: data for store
type: do something for store
}
- Actions. It does something for the store.
- For example: add, remove, update
- Reducers have state and what it intends to do as parameters
- There is only one store per application
- It keeps the application state
- It can contain one or more slices
Steps
- Install redux and redux toolkit
- Create store in store folder, configure and export it
- Provide access to the store my wrapping the main.jsx or index.jsx with the Provider from react-redux
- Create slice or slices, create all the reducers, export it and then add it to the store.
- Use
npm install -g json-server
- serve the json with this format
json-server '<theDataPath/file>.json'