reactjs 突然报错 Error: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?

在将React应用部署到测试环境时遇到了一个minified错误152,提示不能在render方法中直接放置注释。解决方案包括检查并移除render函数内的直接注释,以及确保state初始化正确。这可能涉及到React组件的生命周期管理和状态管理问题。
摘要由CSDN通过智能技术生成

在开发环境没问题,但是测试环境会抱着个错
vendors.umi.da0aa8ca.async.js:formatted:54915 Error: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=se for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at vendors.umi.da0aa8ca.async.js:formatted:53358:25
at Ka (vendors.umi.da0aa8ca.async.js:formatted:54034:36)
at Lu (vendors.umi.da0aa8ca.async.js:formatted:56441:21)
at zs (vendors.umi.da0aa8ca.async.js:formatted:55932:21)
at Ls (vendors.umi.da0aa8ca.async.js:formatted:55925:22)
at Ms (vendors.umi.da0aa8ca.async.js:formatted:55680:25)
at vendors.umi.da0aa8ca.async.js:formatted:52668:37
at t.unstable_runWithPriority (vendors.umi.da0aa8ca.async.js:formatted:1220:24)
at ui (vendors.umi.da0aa8ca.async.js:formatted:52639:13)
at fi (vendors.umi.da0aa8ca.async.js:formatted:52664:21)

解决方案

  1. 排查是否在render 里面直接跟注释
    return ()
    解决: 注释不要直接跟在后面
    2: 排查是否有如下
    在这里插入图片描述
    解决 state ? :null
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值