Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

346
Views
Weird Formatting for nextJs (vscode)

I am using prettier as my formater. When I read a simple JSX function it is written as

function HomePage() {
  return;
  <div>
    <h1>Hello Next.js</h1>
    <p> Welcome to the home page</p>
  </div>;
}

export default HomePage;

however, when saved the autoformatter turns it into

function HomePage() {
    return; <
    div >
        <
        h1 > Hello Next.js < /h1> <
        p > Welcome to the home page < /p> <
        /div>;
}

export default HomePage;

I have turned prettier off and turned most of my other extensions off yet this doesn't change, I belive it is intrinsic to vscode somehow. Anyone have a fix?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

On the lower right, click JavaScript, search JavaScript React, and press enter (this changes the language and prettifies based on React).

Click JavaScript:
enter image description here

Type React then press enter. enter image description here

Saving the file again should autoformat it correctly.

You can do this for all your React (Next.JS) files, or simply in the root directory of your NextJS app, open settings.json (Ctrl+Shift+P → "Open workspace settings (JSON)") and include the following:

"files.associations": {
  "*.js": "javascriptreact"
}
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!