# redux-demos **Repository Path**: react---special-topics/redux-demos ## Basic Information - **Project Name**: redux-demos - **Description**: redux、react-redux、@reduxjs/toolkit 实现状态管理 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-13 - **Last Updated**: 2024-07-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 3.求和案例 redux异步action版 (1).明确:延迟的动作不想交给组件自身,想交给action (2).何时需要异步action:想要对状态进行操作,但是具体的数据靠异步任务返回。 (3).具体编码: + yarn add redux-thunk,并配置在store中 + 创建action的函数不再返回一般对象,而是一个函数,该函数中写异步任务。 + 异步任务有结果后,分发一个同步的action去真正操作数据。 (4).备注:异步action不是必须要写的,完全可以自己等待异步任务的结果了再去分发同步action。 ## 7.求和案例 react-redux开发者工具的使用 (1).yarn add redux-devtools-extension (2).store中进行配置 ```js import composeWithDevToolsl from 'redux-devtools-extension'; const store = createstore(allReducer,composeWithDevTools(applyMiddleware(thunk))); ```