Reac Formating issues in VSCode

Hi all!

Well i have never used REACT before and now i am wondering why my VS Code is autoformatting me the code. I have the following issue.

This is the code i have in the editor at the moment.

React.createElement(
    "div",
    {id: "hello"},
    React.createElment(
        "p",
        null,
        "Lorem, ipsum."
    )
);

But the autoformat “feature” correct it in that way:
Also nice, but for my understanding and for my learning it would help me a lot when
it is not formatted in a one liner.

React.createElement( "div", {id: "hello"}, React.createElment( "p", null, "Lorem, ipsum." ) );

Small node. This is only happening when i am using React in an html File. Yes i am using Prettier as code formatter. But this works perfect for CSS; JS ; and Html. Any ideas for a quick fix ?
Cheers Mchoeti

1 Like

Hey @mchoeti, hope you are ok.

Although is quite difficult to read all the properties in 1 code line, you could also indented yourself, if you check the code you have, is the same but without spaces, so you could add your own spaces until its readable for you, its a very normal method that you use time to time when facing code lines with a lot of descriptions or statements.

Carlos Z

1 Like

Thanks for coming back to me. It depends i mean there is a lot of space between a one line and a couple of lines. But anyway i will check it out later on. Thanks for your support

1 Like