Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode doesn't understand React Fragment <></>, doesn't recognize newer ES syntax (.?)

the .? operator

I am running vscode version 1.39.2. The Syntax highlighting messes up for React fragments and new ES syntax.

like image 716
SaiBorg Avatar asked Oct 16 '19 14:10

SaiBorg


2 Answers

VSCode supports JSX fragment syntax. This problem is likely related to an extension in OP's editor. I found that disabling Babel ES6/ES7 v0.0.4 alleviated this issue for me.

As for the second issue, the latest stable release of VSCode v1.40.0 doesn't support syntax highlighting for optional chaining (i.e. ?.), but the next minor version v1.41 will include it. In the meantime, there are other options you have for adding this feature, detailed by Matt Bierner here.

like image 91
Veekas Avatar answered Oct 28 '22 18:10

Veekas


Disabling Babel E6/E7 extension in VScode worked for me.

like image 7
Akanksha Avatar answered Oct 28 '22 18:10

Akanksha