❤ 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
相关推荐
wenzhangli71 小时前
Ooder A2UI 核心架构深度解析:WEB 拦截层的设计与实现
前端·架构
前端百草阁1 小时前
【前端性能优化全链路指南】从开发编写到构建运行的多维度实践
前端·性能优化
女生也可以敲代码2 小时前
AI时代下的50道前端开发面试题:从基础到大模型应用
前端·面试
ZhengEnCi2 小时前
M5-markconv自定义CSS样式指南 📝
前端·css·python
IT_陈寒2 小时前
SpringBoot自动配置的坑差点让我加班到天亮
前端·人工智能·后端
xingpanvip2 小时前
星盘接口开发文档:星相日历接口指南
android·开发语言·前端·css·php·lua
@PHARAOH2 小时前
WHAT - GitLens supercharged 插件
前端
TT模板3 小时前
苹果cms整合西瓜播放器XGplayer插件支持跳过片头尾
前端·html5
Wect3 小时前
React 性能优化精讲
前端·react.js·性能优化
追风筝的人er4 小时前
SpringBoot+Vue3 企业考勤如何处理法定假期?节假日方案、调休补班与工作日判断链路拆解
前端·vue.js·后端