- We can create a Redux store using the Redux Toolkit configureStore API
- configureStore accepts a reducer function as a named argument
- configureStore automatically sets up the store with good default settings
- Redux logic is typically organized into files called "slices"
- A "slice" contains the reducer logic and actions related to a specific feature/section of the Redux state
- Redux Toolkit's createSlice API generates action creators and action types for each individual reducer function you provide
- Redux reducers must follow specific rules
- Should only calculate a new state value based on the state and action arguments
- Must make immutable updates by copying the existing state
- Cannot contain any asynchronous logic or other "side effects"
- Redux Toolkit's createSlice API uses Immer to allow "mutating" immutable updates
- Async logic is typically written in special functions called "thunks"
- Thunks receive dispatch and getState as arguments
- Redux Toolkit enables the redux-thunk middleware by default
- React-Redux allows React components to interact with a Redux store
- Wrapping the app with <Provider store={store}> enables all components to use the store
- The global state should go in the Redux store, local state should stay in React components
React Redux In A Nutshell
Get to know the full overview of React Redux, Redux Toolkit and Redux Thunk
Created on Mar 26, 2022
•178 views
If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️
Load comments for React Redux In A Nutshell
PostSrc Code Components
Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.
View ComponentsSponsors 👑
+ Add YoursOther Code Snippets
All Snippets
How to Fetch API in Alpine.js
2 years ago

How to Call Console Command From Anywhere in Laravel Codebase
2 years ago

Laravel Eloquent Check Nested Relation Exists
2 years ago

Default Email Subject in Laravel Notifications
2 years ago

How to Display Google AdSense Anchor Ads at the Bottom of the Page
2 years ago

Scroll to Top One-Liner Snippet
1 year ago