javascriptreactjsvisual-studio-codevisual-web-developer

Visual Studio code error while saving react files?


enter image description here

And when i am saving this file with Ctrl+s even using prettier and other javascript extension snippets in visual code i am getting this deformed code which is showing errors enter image description here

And Showing error as:

JSX element div has no corresponding closing tag.
JSX element Navbar has no corresponding closing tag.
JSX element NavbarBrand has no corresponding closing tag.
Identifier expected.
> expected.


Solution

  • Change your file extension to .jsx so the formatter knows that it contains markup