❤ 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
相关推荐
_阿南_8 小时前
项目中新增给AI制定的代码规范
前端·程序员
名字还没想好☜9 小时前
React 实现暗黑模式切换:localStorage 持久化、SSR 首屏闪烁与跟随系统主题
前端·javascript·react.js·ecmascript·react·next.js
console.log('npc')10 小时前
Git 冲突与 AI 协助指南
前端·人工智能·git·大模型
爱学堂IT分享11 小时前
Cesium可视化系统实战课程-Cesium教程学习
前端
糖墨夕12 小时前
理解大语言模型:Agent 的“大脑”
前端·agent
Rain的Java大神之路12 小时前
JavaWeb开发如何解决跨域问题
java·前端·后端·nginx·web安全·面试·运维开发
cpolar技术支持12 小时前
浏览器也能跑本地 AI:用 Transformers.js + WebGPU 做一个最小推理 Demo,cpolar 给同事远程体验
前端·ai·cpolar·webgpu·transformers.js
计算机魔术师14 小时前
OpenAI 发布 GPT-6 Astra:多项基准刷新纪录, cybersecurity 能力达 Critical 阈值
前端
xy345314 小时前
Axure9.0中继器遮罩实现方法
前端·ui·html·axure·原型·产品设计
风骏时光牛马14 小时前
智能任务自动化协同AI工作流
前端