This is a collection of snippets I use in my daily work with React and NextJS - they should come in quite handy.
- Open the command palette (⌃ Control + P or ⌘ Command + P)
- Type
ext install mitchelmore.toms-snippets
Or download directly from the VSCode Marketplace.
Trigger | Content | Usage Notes |
---|---|---|
tsf |
Typescript Functional Component | Component will be named after the file |
tsfp |
Typescript Functional Component with Props | Component will be named after the file |
tsfc |
Typescript Functional Component with Children (and props, incidentally) | Component will be named after the file |
tsfic |
Typescript Functional Component inheriting props from some other element | Component will be named after the file, and typing after the snippet will name the inherited tag (e.g div ) |
np |
NextJS Page | Typing after the snippet will name the page |
npsg |
NextJS Page with Static Props | Typing after the snippet will name the page |
npsr |
NextJS Page with Server-side Rendering | Typing after the snippet will name the page |