❤ 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
相关推荐
小poop6 小时前
CSS 基础与实战:从入门到精通网页美化
前端
Csvn7 小时前
运行时性能
前端
Never_every998 小时前
位图转矢量工具哪个好?实测抠抠图AI位图转矢量工具
大数据·前端
paopaokaka_luck8 小时前
宠物门店经营管理系统(销售与库存联动、进货自动记账、 退换与退款关联、员工个人业绩、ECharts 经营分析、滞销识别与客户分层、宠物档案年龄计算)
前端·javascript·spring boot·mysql·echarts·mybatis·1024程序员节
空中湖9 小时前
用 React 写数据大屏:为什么我不建议用图表库
前端·react.js·前端框架
行者全栈架构师10 小时前
【鸿蒙心迹】让老照片变清晰:HarmonyOS 7.0 图像超分相册工程化落地与 5 个踩坑解法
架构·前端框架·开源
欣欣之王来了10 小时前
原始HTML插值:v-html指令的使用与安全风险
前端·学习·架构·项目·vue3教程
IT_陈寒10 小时前
Redis的LRU淘汰策略坑了我一整天
前端·人工智能·后端
计算机魔术师10 小时前
砍半价格、参数再涨,国产旗舰追到 Opus 鼻尖了
前端
特立独行的猫A11 小时前
10 MB 的桌面 AI 客户端:用仓颉 + 系统 WebView 替代 Electron
前端·harmonyos