gpt4 book ai didi

javascript - 尝试导入错误 : 'useDispatch' is not exported from 'react-redux'

转载 作者:搜寻专家 更新时间:2023-11-01 05:08:48 25 4
gpt4 key购买 nike

我正在尝试通过 useDispatch 方法在 redux 中更新我的商店,但我收到这样的消息:

Attempted import error: 'useDispatch' is not exported from 'react-redux'.

我正在使用此方法调用操作来更新我的商店。

import { useDispatch } from 'react-redux';
import { loggedInAction } from './redux';

const userInfo = () => {
const dispatch = useDispatch();
const loggedIn = user => dispatch(loggedInAction(user));

最佳答案

编辑(2019 年 9 月 15 日):
安装react-redux@7.1.1react-redux@latest

在这里找到最新版本:https://www.npmjs.com/package/react-redux?activeTab=versions


安装react-redux版本:7.1.0-rc.1
或者执行 npm install react-redux@next

关于javascript - 尝试导入错误 : 'useDispatch' is not exported from 'react-redux' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56528111/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com