Why are my JSX HTML tags being broken across multiple lines in my editor?

Viewed 162

[SOLVED]

My code goes from : enter image description here

to this after saving: enter image description here

See the code inside the return statement... It happens after doing a save... It's just so unreadable... What is causing it and how can I fix this?

2 Answers

You're in a .js file, so the automatic formatter VSC uses is for JavaScript, not JSX - it's choking on the <s because in JS, those are operators, not JSX tag delimiters.

Change the file name from App.js to App.jsx for the formatter to work properly.

Yeah there was a JS-CSS-HTML Formatter extension enabled which was causing all this. Disabling it solved the issue. Thanks Brian Thompson.

Related