Since CRA 3.4.1
Probably a babel issue
The following code raise an error on built version :
import React from 'react';
const Component = props => {
return ( // a comment
<div>
toto
</div>
);
export default Component;
After building the app, i get the following error :
react-dom.production.min.js:209 Error: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=Component for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at react-dom.production.min.js:149
at za (react-dom.production.min.js:173)
at vo (react-dom.production.min.js:262)
at cu (react-dom.production.min.js:246)
at ou (react-dom.production.min.js:246)
at Zo (react-dom.production.min.js:239)
at qo (react-dom.production.min.js:230)
at Du (react-dom.production.min.js:281)
at react-dom.production.min.js:284
at tu (react-dom.production.min.js:240)
Removing the comment fixes the error
参考地址:https://github.com/facebook/create-react-app/issues/8687
出现这个报错官网提示
现象: 本地和测试环境没有问题,部署到product之后出现这个问题
解决的方式:
- 删除return 后面的注释
- 检查是否组件中没有返回值(子组件逻辑判断,非空判断中render 是否有返回值,没有加上 return null)