auto import classname Reactjs

i see teacher in a tutorial of Reactjs he type : nav.navbar

and magically <nav className="navbar"></nav> appear. Can some one help me to explain it and how to do this. Thanks a lot

Upvotes: 0

Views: 183

Answers (1)

CertainPerformance
CertainPerformance

Reputation: 370679

That is emmet notation.

At the basics, it will transform a selector: nav.navbar into the HTML (well, JSX) markup equivalent matching that selector: an element with a nav tag name with a class name of navbar.

How to do this will depend on your IDE. For VSCode, for example:

  1. Go to Code (at the top of your screen), then Preferences, then Settings in VSCode
  2. In the options on the left, select Extensions, then Emmet
  3. Scroll to the Include Languages section, add in the item input, javascript and in the value input, javascriptreact and hit Add Item

Upvotes: 2

Related Questions