HomeBrew
HomeBrew

Reputation: 869

Visual Studio Code IDE for Mac shows warnings on React JSX

I'm having a go at React and I'm using Visual Studio Code IDE. The problem I'm having is that it's throwing highlighting errors when returning HTML elements in the render method. I've attached a picture to illustrate. I'm aware of the jsconfig.json file but I don't know what I should add to hide these highlighting warnings.

enter image description here

Upvotes: 1

Views: 1318

Answers (1)

Rik
Rik

Reputation: 3887

React files need a jsx extension for VS Code to highlight them correctly.

I attached screenshots to show. The first one is with js extension. This looks comparable to your screenshot. JS extension for file

Note that with the second I renamed the file to .jsx and the highlighting is correct JSX extension

Upvotes: 2

Related Questions