❤ 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
相关推荐
小白x12 分钟前
Echarts常用配置
前端
hello_Code15 分钟前
css和图片主题色“提取”
前端
小杨梅君15 分钟前
Vue3与iframe通信方案详解:本地与跨域场景
前端·vue.js
IT_陈寒17 分钟前
Redis高频踩坑实录:5个不报错但会导致性能腰斩的'隐秘'配置项
前端·人工智能·后端
CoolerWu20 分钟前
2025 · 我与 AI / Vibe Coding 的一年
前端·后端
张风捷特烈22 分钟前
AI 四格笑话爆火,我做了什么?
前端·aigc
东方-教育技术博主22 分钟前
IDEA 配置electron开发环境
前端·javascript·electron
AC赳赳老秦24 分钟前
DeepSeek-Coder vs Copilot:嵌入式开发场景适配性对比实战
java·前端·后端·struts·mongodb·copilot·deepseek
一只专注api接口开发的技术猿28 分钟前
智能决策数据源:利用 1688 商品详情 API 构建实时比价与供应链分析系统
大数据·前端·数据库
程序员修心42 分钟前
CSS 选择器知识点
前端·css·css3