How to prevent insert spaces in JSX code

Viewed 3179

I have just started learning React Native. I am using Visual Studio Code for editing. Whenever I save my file it is inserting spaces in my JSX code. This reduces the readability of the code. This is code before I save the file

Before Saving the File:
Before Saving the File

This is File after saving:
This is File after saving

I have tried editing VS Code settings

"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false

But it did not help.

Is there any solution to this problem?

3 Answers

Or you could also rename the file changing its extension from .js to .jsx and VSCode will understand that the file is React.

I had this problem and I solved by making js-css-html formatter extension disable and closing the vs code and restart

Related