Attempted import error: 'takeEvery' is not exported from 'redux-saga'.

如题,在 React 项目中使用 redux-saga 中间件时,发现 takeEvery 在 redux-saga module下,而不在 redux-saga/effects module 下。正确引入后,项目运行起来发现报错,错误信息为:Attempted import error: 'takeEvery' is not exported from 'redux-saga'.
这是因为在项目中错误引入了 react-saga 引起的,请检查 package.json中的 dependencies 下是否安装了 react-saga,如果安装了,请将其移除,方法如下:

yarn remove react-saga

or

npm  uninstall  react-saga

然后重新运行项目即可。

如果上述方法依然不奏效,请删除 redux-soga 依赖后重新安装,命令如下

yarn remove redux-saga;
yarn add redux-soga;

如果帮到了您,请留下您的赞👇,非常感谢😃。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容