question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Minified React error #152 - comments before JSX

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:144
  • Comments:57 (1 by maintainers)

github_iconTop GitHub Comments

50reactions
jonnyelliotcommented, Apr 23, 2020

I used this regex in VSCode to find the troublesome comments: \(\s*\n?\s*//

9reactions
Demerjianmcommented, Mar 21, 2020

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

I was able to resolve mine by removing the comments as well. Not sure of a fix yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Minified React error #152 - how to resolve this? - Stack Overflow
The error description is here, you return nothing as result of render method of you react component. Return something else instead of it....
Read more >
How to Fix Minified React error #152 - Amit K Khanchandani
Error: “Minified React error #152; visit https://reactjs.org/docs/ ... Removed the comments from the start of the rendering part (return).
Read more >
[Solved]-Minified React error #152 - how to resolve this?-Reactjs
The error description is here, you return nothing as result of render method of you react component. Return something else instead of it....
Read more >
Minified React error #152; : r/Firebase - Reddit
Hey there ! this is the second time I tried to deploy an app into firebase and it's the second time I get...
Read more >
React App Deployed To Github Giving Me A Minified Error #152
Javascript answers related to Error: Minified React error #152 Make sure Node.js is installed and in your PATH or set the runtimeExecutable in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found