

Memoized selector functions with the Reselect library for optimizing derived data.Normalized state to enable looking up items by ID.Thunk functions that contain sync or async logic with side effects.Action creators that generate those action objects.While it's not required, your Redux code also normally includes: Pure reducer functions looking at those actions and returning immutably updated state.Dispatching plain object actions to the store when something happens in the app.

A single store containing "global" state.The first thing to ask is, "what is Redux?" How Redux Toolkit Is Different Than the Redux Core What Is "Redux"? Simplify an existing application, Redux Toolkit can help you

Whether you're a brand new Redux user setting up your first project, or an experienced user who wants to RTK includes utilities that help simplify many common use cases, including store setup,Ĭreating reducers and writing immutable update logic,Īnd even creating entire "slices" of state at once. If you are writing any Redux logic today, you should be using Redux Toolkit to write that code! Redux Toolkit builds in our suggested best practices, simplifies most Redux tasks, prevents common mistakes, and makes it easier to write Redux applications. The package wraps around the core redux package, and contains API methods and common dependencies that we think are essential for building a Redux app. Redux Toolkit (also known as "RTK" for short) is our official recommended approach for writing Redux logic.
#Reduxjs toolkit createslice how to#
Why Redux Toolkit is How To Use Redux Today What is Redux Toolkit?
