移除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';

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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子盗蟆,更是在濱河造成了極大的恐慌滥玷,老刑警劉巖议谷,帶你破解...
    沈念sama閱讀 216,402評論 6 499
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件巫玻,死亡現(xiàn)場離奇詭異榜配,居然都是意外死亡极祸,警方通過查閱死者的電腦和手機(jī)慈格,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,377評論 3 392
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來遥金,“玉大人浴捆,你說我怎么就攤上這事「逍担” “怎么了选泻?”我有些...
    開封第一講書人閱讀 162,483評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長美莫。 經(jīng)常有香客問我页眯,道長,這世上最難降的妖魔是什么厢呵? 我笑而不...
    開封第一講書人閱讀 58,165評論 1 292
  • 正文 為了忘掉前任窝撵,我火速辦了婚禮,結(jié)果婚禮上襟铭,老公的妹妹穿的比我還像新娘碌奉。我一直安慰自己,他們只是感情好蝌矛,可當(dāng)我...
    茶點故事閱讀 67,176評論 6 388
  • 文/花漫 我一把揭開白布道批。 她就那樣靜靜地躺著,像睡著了一般入撒。 火紅的嫁衣襯著肌膚如雪隆豹。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,146評論 1 297
  • 那天茅逮,我揣著相機(jī)與錄音璃赡,去河邊找鬼判哥。 笑死,一個胖子當(dāng)著我的面吹牛碉考,可吹牛的內(nèi)容都是我干的塌计。 我是一名探鬼主播,決...
    沈念sama閱讀 40,032評論 3 417
  • 文/蒼蘭香墨 我猛地睜開眼侯谁,長吁一口氣:“原來是場噩夢啊……” “哼锌仅!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起墙贱,我...
    開封第一講書人閱讀 38,896評論 0 274
  • 序言:老撾萬榮一對情侶失蹤热芹,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后惨撇,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體伊脓,經(jīng)...
    沈念sama閱讀 45,311評論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,536評論 2 332
  • 正文 我和宋清朗相戀三年魁衙,在試婚紗的時候發(fā)現(xiàn)自己被綠了报腔。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,696評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡剖淀,死狀恐怖纯蛾,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情祷蝌,我是刑警寧澤茅撞,帶...
    沈念sama閱讀 35,413評論 5 343
  • 正文 年R本政府宣布帆卓,位于F島的核電站巨朦,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏剑令。R本人自食惡果不足惜糊啡,卻給世界環(huán)境...
    茶點故事閱讀 41,008評論 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望吁津。 院中可真熱鬧棚蓄,春花似錦、人聲如沸碍脏。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,659評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽典尾。三九已至役拴,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間钾埂,已是汗流浹背河闰。 一陣腳步聲響...
    開封第一講書人閱讀 32,815評論 1 269
  • 我被黑心中介騙來泰國打工科平, 沒想到剛下飛機(jī)就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人姜性。 一個月前我還...
    沈念sama閱讀 47,698評論 2 368
  • 正文 我出身青樓瞪慧,卻偏偏與公主長得像,于是被迫代替她去往敵國和親部念。 傳聞我的和親對象是個殘疾皇子弃酌,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,592評論 2 353

推薦閱讀更多精彩內(nèi)容