❤ React报错问题分析

❤ 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.

♥ 原因

导入两个组件,需要将两个组件放在一个容器内

cpp 复制代码
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 脚本的安装。按照这些简单的步骤来让它工作

解决方法一:

js 复制代码
删除 node_modules 文件夹
删除 package-lock.json 文件
跑 npm install   //yarn install
跑 npm i -S react-scripts //yarn add -S react-scripts
跑 npm start //yarn start
相关推荐
不会敲代码12 小时前
TCP/IP 与前端性能:从数据包到首次渲染的底层逻辑
前端·tcp/ip
kyriewen2 小时前
奥特曼借GPT-5.5干杯,而你的Copilot正按Token收钱
前端·github·openai
AC赳赳老秦2 小时前
投标合规提效:用 OpenClaw 实现标书 / 合同自动审核、关键词校验、格式优化,降低废标风险
开发语言·前端·python·eclipse·emacs·deepseek·openclaw
kyriewen2 小时前
代码写成一锅粥?3个设计模式让你的项目“起死回生”
前端·javascript·设计模式
千寻girling3 小时前
《 Git 详细教程 》
前端·后端·面试
之歆4 小时前
DAY08_CSS浮动与行内块布局实战指南(下)
前端·css
yqcoder4 小时前
CSS Position 全解析:5 种定位模式详解
前端·css
Rhi6375 小时前
从零搭建项目:React 19 + Vite 8 + Tailwind CSS v4 实战配置
前端
竹林8185 小时前
用Viem替代ethers.js:从一次签名失败到完整迁移的实战记录
前端·javascript
之歆5 小时前
DAY08_CSS浮动与行内块布局实战指南(上)
前端·css