有哪位小伙伴知道报这个错是因为版本问题吗,解决了好久还没解决掉,只能来求助各位小伙伴了
//卸载组件的回调
function unmount(){
ReactDOM.unmountComponentAtNode(document.getElementById('root'))
}
return (
<div>
<h1>求和为:{count}</h1>
<button onClick={add}>点我+1</button>
<button onClick={unmount}>卸载组件</button>
</div>
)
}
export default Demo3;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/css/bootstrap.css">
<title></title>
</head>
<body>
<div id="root">
</div>
</body>
</html>