企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# API 文档 Redux 的 API 非常少。Redux 定义了一系列的约定(contract)来让你来实现(例如 [reducers](#)),同时提供少量辅助函数来把这些约定整合到一起。 这一章会介绍所有的 Redux API。记住,Redux 只关心如何管理 state。在实际的项目中,你还需要使用 UI 绑定库如 [react-redux](https://github.com/gaearon/react-redux)。 ### 顶级暴露的方法 - [createStore(reducer, [initialState])](#) - [combineReducers(reducers)](#) - [applyMiddleware(...middlewares)](#) - [bindActionCreators(actionCreators, dispatch)](#) - [compose(...functions)](#) ### Store API - [Store](#) - [getState()](#) - [dispatch(action)](#) - [subscribe(listener)](#) - [getReducer()](#) - [replaceReducer(nextReducer)](#) ### 引入 上面介绍的所有函数都是顶级暴露的方法。都可以这样引入: #### ES6 ~~~ import { createStore } from 'redux'; ~~~ #### ES5 (CommonJS) ~~~ var createStore = require('redux').createStore; ~~~ #### ES5 (UMD build) ~~~ var createStore = Redux.createStore; ~~~