简体   繁体   中英

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

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'));

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM