React intellisense in Visual Studio Code

后端 未结 5 1946
忘了有多久
忘了有多久 2021-01-31 18:39

I\'m sure I\'m missing something simple, but I simply can\'t get React.js IntelliSense to work in Visual Studio code.

I have done the following:

  • npm
5条回答
  •  再見小時候
    2021-01-31 19:07

    Now that typings (and for that matter tsd) are both no longer recommended. I found the one line answer for my situation was just to include type definitions from npm with the command

    npm i @types/react --save-dev

    intellisense picked up the new definitions for me immediately in Visual Studio Code, but perhaps for someone else you may need to restart your VSCode window.

    I'm not sure if it's relevant but my app was created with create-react-app with the latest version.

提交回复
热议问题