React踩坑日记React启动后报错TypeError Cannot read properties of undefined (reading ‘forEach‘)

简介: React踩坑日记React启动后报错TypeError Cannot read properties of undefined (reading ‘forEach‘)

前言今天创建新项目运行后又出现这个问题了,之前也出现过,觉得是很正常的情况,不过我今天发现还有许多朋友不知道这个问题的解决方法,特地来记录一下。

话不多说 上图:

这个情况呢是由于你的浏览器安装了React-DevTools扩展程序的原因,安装这个东西是为了方便我们查看React元素和编译之后的一些代码,很多朋友是直接删除了,但是这不就等于是壮士断腕了嘛。解决方法如下:

1.进入项目中按照路径找到相应的文件

/node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js

2.

注释后重新npm start 报错解决的同时React-DevTools也能用

相关文章
|
5月前
|
前端开发 JavaScript 区块链
react18函数组件+antd使用指南-使用代码集合以及报错记录汇总
本文介绍了多个React开发中常见的问题及其解决方案,包括但不限于:1)`useForm`实例未连接到任何`Form`元素的警告及解决方法;2)监听页面滚动事件的实现方式;3)React 18与antd 5.8.6中定制主题的方法;4)React结合antd 4.x版本自定义主题色的步骤;5)解决`ResizeObserver loop`相关报错的技巧;6)处理React设计表单时遇到的CDN资源加载失败问题;7)解决onClick事件传参问题;8)修复类型错误等。每部分均提供详细分析与实用代码示例,帮助开发者快速定位并解决问题。
95 3
|
5月前
|
JSON 前端开发 中间件
React读取properties配置文件转化为json对象并使用在url地址中
本文介绍了如何在React项目中读取properties配置文件,将其内容转化为JSON对象,并在请求URL地址时使用这些配置。文章详细说明了异步读取文件、处理字符串转换为JSON对象的过程,并提供了一个封装函数,用于在发起请求前动态生成配置化的URL地址。
126 1
|
5月前
|
前端开发 JavaScript Java
SpringBoot项目部署打包好的React、Vue项目刷新报错404
本文讨论了在SpringBoot项目中部署React或Vue打包好的前端项目时,刷新页面导致404错误的问题,并提供了两种解决方案:一是在SpringBoot启动类中配置错误页面重定向到index.html,二是将前端路由改为hash模式以避免刷新问题。
398 1
|
6月前
|
存储 JavaScript 前端开发
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
|
6月前
|
前端开发
React使用useRef ts 报错
【8月更文挑战第17天】
119 4
|
6月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
128 0
|
6月前
|
JavaScript
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
122 0
|
6月前
|
前端开发 JavaScript
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
143 0
Cannot read properties of undefined (reading ‘row‘)
Cannot read properties of undefined (reading ‘row‘)
|
前端开发
React报错:TypeError: Cannot call a class as a function
React报错:TypeError: Cannot call a class as a function
806 0
React报错:TypeError: Cannot call a class as a function