Microsoft Visual Studio Code Problem

Hi!
I try to create project, and use the MVS Code. When I try to save index.js with the HTML tags MVS breaks this tags and push space between words and brackets. Can’t find how I can fixt it…

// there is before safe project
ReactDOM.render( <div> Hello World! </div>, document.getElementById('root'))
//there is after safe project
ReactDOM.render( < div > Hello World! < /div>, document.getElementById('root'))

Hi @IgorSushko1

This happens because VS Code is formating the code everytime you save it, there are 2 options to fix this:

  1. Go to settings
    Search for “Fomat on save”
    Disable (uncheck) “Editor: Format On Save”

  2. Make sure you have the ESLint extension installed and enabled
    Configure ESLint to correctly lint JSX code (Take a look at this Stack Overflow answer)

Thanks! I found thats going wrong)) This extension i had but i didnt switch it in JavaScript React language 1

1 Like