https://github.com/iamvishalaggarwal/blog-webapp-thunk
Creating Post Feeds Using Redux Thunk (Learning)
https://github.com/iamvishalaggarwal/blog-webapp-thunk
Last synced: about 1 month ago
JSON representation
Creating Post Feeds Using Redux Thunk (Learning)
- Host: GitHub
- URL: https://github.com/iamvishalaggarwal/blog-webapp-thunk
- Owner: iamvishalaggarwal
- Created: 2024-07-31T07:37:41.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-31T16:36:34.000Z (10 months ago)
- Last Synced: 2025-02-13T23:44:37.031Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Redux & Redux Toolkit
- redux is a core library
- react-redux is an implementation of redux using react (used for wiring between react & redux)- following are the steps of using redux-toolkit :
- build store (mostly have single store - known as single source of truth) - createStore- add features (slice - term used for representing reducers) - createSlice
-- createSlice contains - name, initialState, reducers
-- the name which we give here, will be shown on browser redux toolkit dev extension
-- reducers contains all type of actions which we need to perform for that feature
-- the function which we write inside reducer, contains two things - state and action, in which state contains the data which we store as a initialState but with updated and action contains the payload part- whenever we need to perform any action we need to store **useDispatch()**
- when we need to read the value - **useSelector()** is usedNote:
- redux uses immer.js for handling immutable states functionality internally
## Thunk - Redux Middleware
- the word 'thunk' is a programming term that means "a piece of code that does some delayed work"
- used for writing standard async logic for redux## Optimisation -
- we can use React.memo() for avoiding multiple re-renders of component
- Normalization - using "createEntityAdapter()"