控制台显式问题:
Warning: You are calling ReactDOMClient.createRoot() on a container
that has already been passed to createRoot() before. Instead, call
root.render() on the existing root instead if you want to update it.
解决
如下注释
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import store from './redux/store'
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
store.subscribe(() => {
// const root = ReactDOM.createRoot(document.getElementById('root'));**将此行注释 版本原因引起的问题**
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
})