Ramon Balthazar
Ramon Balthazar

Reputation: 4260

In VSCode, how to import React through IntelliSense?

In the image below, if I press Enter nothing happens.

I was expecting IntelliSense to add import React from 'react'; to the top of the file.

enter image description here

Upvotes: 0

Views: 63

Answers (1)

Dor Shinar
Dor Shinar

Reputation: 1512

I think your best shot should be using snippets. You can either create one for yourself (here's the official VSCode snippets documentation), or you could use an existing snippets extension (like this one).

I Believe a snippet you could use would look something like so:

{
  "Import React": {
    "prefix": ["React"],
    "body": ["import React from \"react\";"],
    "description": "Importing React"
  }
}

Upvotes: 1

Related Questions