Home > Net >  I am getting this error in react : JSX element 'h1' has no corresponding closing tag
I am getting this error in react : JSX element 'h1' has no corresponding closing tag

Time:09-18

I am new to raect. I created react project and when I am creating new component I am gettinng this error in all the components. I this there is no mistack in the code but don't know why I am getting this error.

code : import ReactDom from "react-dom";

ReactDom.render( < h1 > Hello World < /h1>, document.getElementById('root'));

CodePudding user response:

As per enve comment - remove the spaces, add react into the namespace:

import React from „react” 

Check the file extension (should be *.jsx)

This most likely will solve your problem.

If it still persists you will have to disable editor on save action and check code for prettier rules.

  • Related