移除react遇到的问题|移除react遇到的问题 2021-04-23
What comes out the error "TypeError: Cannot read property 'createContext' of undefined"?
I want to try to make authorize via Google and try to use TS.
Did a simulated authorization sagas and all worked OK. Then all components were in jsx.
Now everything is going without errors but in the console gives an error
Uncaught TypeError: Cannot read property 'createContext' of undefined
at eval (Context.js:4)
at Object../node_modules/react-redux/es/components/Context.js (the bundle.min.js:497)
at __webpack_require__ (the bundle.min.js:20)
at eval (Provider.js:7)
at Object../node_modules/react-redux/es/components/Provider.js (the bundle.min.js:509)
at __webpack_require__ (the bundle.min.js:20)
at eval (index.js:3)
at Object../node_modules/react-redux/es/index.js (the bundle.min.js:665)
at __webpack_require__ (the bundle.min.js:20)
at eval (index.tsx:5)
ry to add the loader
exclude: /node_modules/
And in tsconfig.json you can add:
"allowSyntheticDefaultImports": true,
and use a normal import in your code:
import React from 'react';
【移除react遇到的问题|移除react遇到的问题 2021-04-23】The problem, as I understood, that the property "allowSyntheticDefaultImports" set to the value false, the loader parses the library in node_modules, and default imports React to do with the current settings can not.
Thank you. helped. Only if you do a normal import, it will pop up a similar error, but instead will createContext Component. Therefore, the import left, and the rest was replaced as you said. - Sandra_Homeni commented on March 24th 20 at 14:50
@Sandra_Homeni, try to add in tsconfig.json is still here:
"moduleResolution": "node",
and try again. - haze commented on March 24th 20 at 14:53
推荐阅读
- 遇到一哭二闹三打滚的孩子,怎么办┃山伯教育
- react|react 安装
- 遇到不正当请求怎么办
- python-安装sublime遇到异常
- Spring|Spring Boot部署到Resin遇到的问题
- 塔罗占卜(近期是否会遇到避不开的劫数(准爆了))
- 大年初三遇到情人节
- React.js学习笔记(17)|React.js学习笔记(17) Mobx
- 面对困难
- 界面展示bug随笔