[英]_react.default.useContext is not a function
https://codesandbox.io/s/v3o3zmxk90 https://codesandbox.io/s/v3o3zmxk90
function VerticalLinearStepper() {
console.log("useStyles----->", useStyles);
const classes = useStyles();
const [activeStep, setActiveStep] = React.useState(0);
const steps = getSteps();
function handleNext() {
setActiveStep(prevActiveStep => prevActiveStep + 1);
}
function handleBack() {
setActiveStep(prevActiveStep => prevActiveStep - 1);
}
function handleReset() {
setActiveStep(0);
}
@material-ui/styles has a peer dependency on react >= 16.7.0-alpha.0 and react-dom >= 16.7.0-alpha.0 Update your react and react-dom dependencies to: @ material-ui / styles对react> = 16.7.0-alpha.0和react-dom> = 16.7.0-alpha.0具有对等依赖关系将您的react和react-dom依赖关系更新为:
"dependencies": {
"react": "^16.7.0-alpha.2",
"react-dom": "^16.7.0-alpha.2",
},
From what I can see, you are using a version of React that does not yet have support for hooks ( useXXX
) 从我所看到的,你使用的是一个尚未支持钩子的React版本(
useXXX
)
It sometimes confuses me too, but latest
as a version in your package.json
actually means "Latest stable version". 它有时会让我感到困惑,但
latest
的package.json
的版本实际上意味着“最新的稳定版本”。
To use a version that supports hooks, you can use the version next
for react
as well as react-dom
:) 要使用支持挂钩的版本,您可以使用
next
版本进行react
以及react-dom
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.