API Reference
This section documents the original Redux core API. The Redux core is small - it defines a set of contracts for you to implement (such asreducers) 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 corecreateStore method is deprecated!
createStore will continue to work indefinitely, but we discourage direct use ofcreateStore or the originalredux package.
Instead, you should usetheconfigureStore method from our officialRedux Toolkit package, which wrapscreateStore to provide a better default setup and configuration approach. You should also use Redux Toolkit'screateSlice method for writing reducer logic.
Redux Toolkit also re-exports all of the other APIs included in theredux package as well.
See theMigrating to Modern Redux page for details on how to update your existing legacy Redux codebase to use Redux Toolkit.
Top-Level Exports
- createStore(reducer, preloadedState?, enhancer?)
- combineReducers(reducers)
- applyMiddleware(...middlewares)
- bindActionCreators(actionCreators, dispatch)
- compose(...functions)