1

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/>
    </>
    );
}
  • Checkout this link for prop completion https://dev.to/maxbvrn/react-props-auto-complete-in-vs-code-2ana You should clarify whether you expect the tag names or their attributes to be auto completed – Ruan Mendes Dec 06 '21 at 21:51
  • Do you mean the attributes for those tags or the tags themselves? If the attributes, https://stackoverflow.com/a/70249577/836330 may help. – Mark Dec 06 '21 at 21:51
  • check answers here https://stackoverflow.com/questions/39320393/jsx-or-html-autocompletion-in-visual-studio-code – wagonaf979 Dec 07 '21 at 09:17

1 Answers1

3

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.

wagonaf979
  • 46
  • 2