Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code: how to add all default snippet of HTML files into react js files?

I have learnt html, js and css. Now I want to learn React. Now I am very used to use snippets of HTML files such as div.className and by pressing enter it gives me <div class="className"></div>. When using React the HTML part is in return in a js file. How can I add all default snippet in VS Code of HTML files into react js files?

like image 235
mistertl Avatar asked Jan 26 '26 22:01

mistertl


1 Answers

You need to have Emmet extension Installed in VSCode.

Then you need to add this line of Code in your settings.json of VSCode Settings and you will have all the emmet formatting for JSX.

  "emmet.includeLanguages": {
    "javascript": "javascriptreact"
  },

And also if not already set, you will need these two settings as well.

  "editor.formatOnPaste": true,
  "editor.formatOnSave": true,

And Emmet will start to format your JSX just like it does in normal HTML

like image 199
Imran Rafiq Rather Avatar answered Jan 28 '26 14:01

Imran Rafiq Rather