网站建设网上接单,重庆网站建设选承越,wordpress能改用户名吗,wordpress grace免费主题报错#xff1a;
出现的原因#xff1a;在于把react18使用的vite构建#xff0c;在开发中因react版本太高与其他库不兼容#xff0c;而在降级的时候#xff0c;出现以上dom渲染出现报错。
解决#xff1a;将 src/index.j文件改成如下
import React from react;
import…报错
出现的原因在于把react18使用的vite构建在开发中因react版本太高与其他库不兼容而在降级的时候出现以上dom渲染出现报错。
解决将 src/index.j文件改成如下
import React from react;
import ReactDOM from react-dom;
import ./index.css;
import App from ./App;
import reportWebVitals from ./reportWebVitals;ReactDOM.render(React.StrictModeApp //React.StrictMode,document.getElementById(root)
)
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
注意在降级修改package.json时候需要注意react、react-dom的版本一致然后重新 npm install 即可。以下给出package.json文件
{name: hello-react,version: 0.1.0,private: true,dependencies: {testing-library/jest-dom: ^5.17.0,testing-library/react: ^13.4.0,testing-library/user-event: ^13.5.0,react: ^16.14.0,react-dom: ^16.14.0,react-scripts: 5.0.1,web-vitals: ^2.1.4},scripts: {start: react-scripts start,build: react-scripts build,test: react-scripts test,eject: react-scripts eject},browserslist: {production: [0.2%,not dead,not op_mini all],development: [last 1 chrome version,last 1 firefox version,last 1 safari version]}
}