react引用react-redux,写项目的时候,出现错误:

TypeError:_WEBPACK_IMPORTED_MODULE_0_react___default.a.createContext is not a function

错误形式:

如图:
TypeError:_WEBPACK_IMPORTED_MODULE_0_react___default.a.createContext is not a function

错误原因

react-redux版本更新到6.0以上,版本更新问题

解决方案

降低react-redux版本,首先将package.json文件下的react-redux版本号修改为5.0.6,如图:
TypeError:_WEBPACK_IMPORTED_MODULE_0_react___default.a.createContext is not a function
之后运行 npm install,再运行npm start,如果你的代码没问题,就可以正常运行。

类似错误(解决方式类似):

TypeError:_WEBPACK_IMPORTED_MODULE_0_react___default.a.createContext is not a function

相关文章:

  • 2021-07-27
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-15
  • 2021-05-02
  • 2022-01-18
  • 2021-11-24
  • 2021-09-10
  • 2022-02-02
  • 2021-09-23
相关资源
相似解决方案