Visual studio code changes format (React-JSX) Visual studio code changes format (React-JSX) reactjs reactjs

Visual studio code changes format (React-JSX)


In the end what did the trick was changing the file format from JavaScript to JavaScript React on the bottom toolbar.I'm publishing it here for future reference since I didn't find any documentation on this topic.

enter image description here

In addition to the above. If you click 'Configure File Association for .js' you can set all .js files to Javascript React


change vscode preferences settings > user settings below:

"files.associations": {        "*.js":"javascriptreact"    }


You can prevent VSC from incorrectly formatting your JSX by adding an association in your settings.json

Code > Preferences > Settings

In the settings window search for associations, click edit in settings.json and then add:

"files.associations": {    "*.js": "javascriptreact"}