This section documents the original Redux core API. The Redux core is small - it defines a set of contracts for you to implement (such as reducers) and provides a few helper functions to tie these contracts together.
In practice, you won't use the Redux core directly. Redux Toolkit is our official recommended approach for writing Redux logic. It wraps around the Redux core, and contains packages and functions that we think are essential for building a Redux app. Redux Toolkit builds in our suggested best practices, simplifies most Redux tasks, prevents common mistakes, and makes it easier to write Redux applications. Additionally, React-Redux lets your React components talk to the Redux store.
See their API docs here:
The original Redux core
createStore method is deprecated!
createStore will continue to work indefinitely, but we discourage direct use of
createStore or the original
Instead, you should use the
configureStore method from our official Redux Toolkit package, which wraps
createStore to provide a better default setup and configuration approach. You should also use Redux Toolkit's
createSlice method for writing reducer logic.
Redux Toolkit also re-exports all of the other APIs included in the
redux package as well.
See the Migrating to Modern Redux page for details on how to update your existing legacy Redux codebase to use Redux Toolkit.
- createStore(reducer, preloadedState?, enhancer?)
- bindActionCreators(actionCreators, dispatch)