'i can't add html tag in ReactDOM render file in vscode

import React from 'react';
import ReactDOM from 'react-dom';

const data = < h1 > hello world! < /h1>
ReactDOM.render(data,
    document.getElementById('root')
);

Today I wanted to work on reactjs but I had a problem that when I save that code in vs code after the code changes, it puts extra spaces between them in the html tag which causes a bug. I wanted to know if any of you had this problem and could have a problem Thank you for helping me solve it



Solution 1:[1]

Your code is fine. The render method does not require a component. A element like you have will work too.

This is a common problem in VS Code Studio typically due to editor settings or extensions.

See a few answers for potential solutions:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 juicy-g