简体   繁体   English

React Redux:可以使用useDispatch连接到动作创建者吗? 如果是这样,怎么办?

[英]React Redux: Can useDispatch be used to connect to an action creator? If so , how?

如果我使用的是功能组件,如何使用useDispatch或其他替代方法连接到动作创建器函数?

I got it. 我知道了。

const dispatch = useDispatch()
dispatch(actionCreator())

it's in the docs 它在文档中

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从反应 redux 使用调度和连接 - useDispatch and connect from react redux 如何使用thunk和useDispatch(react-redux hooks)从动作返回一个promise? - How to return a promise from an action using thunk and useDispatch (react-redux hooks)? 如何使用Redux,React和TypeScript在连接的组件中维护动作创建者类型? - How to maintain action creator types in connected components with Redux, React and TypeScript? 如何在动作创建者 React Typescript Redux 中返回所需的类型 - How to return the desired type in action creator React Typescript Redux 如何在没有 mapDispatchtoProps 但使用 useDispatch 的情况下使用来自 redux 的操作? - How can I use my action from redux without mapDispatchtoProps but with useDispatch? REACT NATIVE REDUX如何在动作创建者收到的化简器中设置数组 - REACT NATIVE REDUX How to set an array in the reducer received by the action creator 如何使用 react-redux 在功能组件中调用动作创建者? - How to call a action creator in a functional component with react-redux? 如何在redux action creator中调用react组件的函数 - How to invoke a function of react component in redux action creator React redux hook useDispatch 函数完成后如何调用 - React redux hook useDispatch function how can I call something after it finish 我们如何在调度中等待 redux action creator 中的特定值? - How can we await in dispatch for a particular value in redux action creator?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM