Home > Software engineering >  Autocomplete for React components in vscode
Autocomplete for React components in vscode

Time:12-07

is there a way for autocomplete react components like JSX tags , like this code below, I want VS code to autocomplete Header, Main and Footer Components and so on

function App() {
    return (
    <>
      <Header />
      <Main />
      <Footer/>
    </>
    );
}
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

CodePudding user response:

The most straight-forward way to get JSX/HTML autocomplete in your React projects is to add this to your user settings or workspace settings (<project-path>/.vscode/settings.json):

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

You may have to restart VS Code for the change to take effect.

  • Related