Reputation: 34014
import React, { useContext } from 'react';
useContext is undefined.
error details:
Uncaught (in promise) TypeError: Object(...) is not a function
error when processing
const context = useContext(UserContext);
Current react versions:
"react": "^16.7",
"react-dom": "^16.7",
Upvotes: 2
Views: 2508
Reputation: 34014
To fix the issue downgrade react and react-dom to 16.7.0-alpha.2 as hooks are not available in v16.7
"react": "16.7.0-alpha.2",
"react-dom": "16.7.0-alpha.2"
Upvotes: 5