- 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
•120 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
Laravel Valet Change PHP Version on MacOS
1 year ago

How To Add a Favicon to Your Website the Easy Way
6 months ago

Commands To Install LAMP Stack on Ubtuntu 16.04 (Short Guides)
1 year ago

How to Conditionally Query Eloquent in Laravel
1 year ago

How to Install NGINX on macOS Monterey
1 year ago

How to Create Your Own Custom Blade Directive in Laravel 8
1 year ago