❤ React报错问题分析
❤️ You passed a second argument to root.render(…) but it only accepts one argument.
You passed a second argument to root.render(…) but it only accepts one argument.
react-dom.development.js:86 Warning: You passed a second argument to root.render(…) but it only accepts one argument.
♥ 原因
导入两个组件,需要将两个组件放在一个容器内
const root = ReactDOM.createRoot(document.getElementById('root'))
root.render(<><Header></Header>,<Footer></Footer></>
);
❤️ ‘react-scripts’ is not recognized as an internal or external command,operable program or batch file.
npm start 运行项目遇见:
原因:
有一些问题npm install无法完成 React 脚本的安装。按照这些简单的步骤来让它工作
解决方法一:
删除 node_modules 文件夹
删除 package-lock.json 文件
跑 npm install //yarn install
跑 npm i -S react-scripts //yarn add -S react-scripts
跑 npm start //yarn start