K
K
Kir032019-07-18 19:12:06
typescript
Kir03, 2019-07-18 19:12:06

What causes the error "TypeError: Cannot read property 'createContext' of undefined"?

I want to try to make authorization through Google and try to use TS.
Before that, I did an imitation of authorization with sagas and everything worked OK. Then all the components were in jsx.
Now everything is going without errors, but in the console it 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 (bundle.min.js:497)
    at __webpack_require__ (bundle.min.js:20)
    at eval (Provider.js:7)
    at Object../node_modules/react-redux/es/components/Provider.js (bundle.min.js:509)
    at __webpack_require__ (bundle.min.js:20)
    at eval (index.js:3)
    at Object../node_modules/react-redux/es/index.js (bundle.min.js:665)
    at __webpack_require__ (bundle.min.js:20)
    at eval (index.tsx:5)

I can't understand why.
Link to the repository https://github.com/noombasa/testGoogleSignIn

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-07-18
@Kir03

Try to add to the loader A in tsconfig.json you can add: and use normal import in the code: The problem, as far as I understand, is that the property is set to , the loader parses the libraries in node_modules, and React cannot do default imports with the current settings.
"allowSyntheticDefaultImports"false

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question