Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ojasskapre/redux-demo
https://github.com/ojasskapre/redux-demo
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ojasskapre/redux-demo
- Owner: ojasskapre
- Created: 2024-02-05T07:14:35.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-05T19:20:16.000Z (11 months ago)
- Last Synced: 2024-10-19T16:10:01.825Z (3 months ago)
- Language: JavaScript
- Size: 182 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Redux and Redux-Toolkit demo
This repository contains code for
- Redux and Redux Toolkit in a simple JS application
- Redux Toolkit in a React application (JS / TS)The structure of the state that we will be managing is
```json
{
"books": {
"inStock": 100
},
"journals": {
"inStock": 50
}
}
```## Concepts
#### What is Redux?
Redux is a predictable state container for all JavaScript applications
#### Three Core Concepts of Redux
1. Store - holds the state of the application
2. Action - describes what's happening in the application
3. Reducer - handles the actions and describes how to update the state#### Three Principles of Redux
1. Application state is stored as an single object
2. Only way to update the state is to dispatch an action (an object that describes what has happened)
3. Write pure reducers that determines how the state changes
![Redux Cycle](./redux-cycle.png)