loading...

How to use Emmet with React/JSX?

twitter logo github logo ・1 min read

Hi, hello, dober dan!

This isn't a tutorial sadly, more of a request for knowledge :D

Been learning React recently. As probably many of you I also use Emmet when it comes to writing HTML code more quickly. I wanted to use Emmet for JSX and found myself confused as to why it doesn't work consistently?

First thing I did was change the "Workplace settings" in VSCode as how this issue instructed: https://github.com/Microsoft/vscode/issues/41998

That worked, BUT when I created a new .js file in my src folder for example and tried writing React/JSX code in it, Emmet didn't work. The only solution I could figure out was to manually change the file type to javascriptreact every time I create a new file.

Does anyone have a link to a solution? Thanks :D

twitter logo DISCUSS (3)
markdown guide
 

Hi,
For me answer from stackoverflow.com works perfectly

// add to your vscode settings
{
"files.associations": {
"*.js": "javascriptreact"
}
}

 
 

Isn't jsx supposed to contain JSX/JS and JS to contain JS only?

Classic DEV Post from Jun 24 '19

What If I Want My Website to Last for 100 Years?

When all other resources fail me, technical blogs come to the rescue. They provide insight into my pr...

Žane Suhadolnik profile image
Web Development, Programming, Computers, Books, Outdoors, Metal, Games, Random thoughts.

👋 Hey dev.to reader.

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❤️