A VSCode extension to effortlessly generate React and Next.js files with customizable templates.
- Automatically generate React components with SCSS modules and test file
- Supports NextJS file structure
- Loading
- Error
- Page
- Layout
- Customizable templates
- Integration with VSCode commands
- Snippets for React/Next components
Prefix | Description |
---|---|
rimr |
JavaScript/TypeScript: import react |
rfc |
JavaScript/TypeScript: React functional component |
rfce |
JavaScript/TypeScript: React functional component with useEffect |
rfcs |
JavaScript/TypeScript: React functional component with useState |
rctx |
JavaScript/TypeScript: React context with provider and hook |
nxpg |
NextJS page file |
nxlayout |
NextJS layout |
nxerror |
NextJS error |
nxloading |
NextJS loading |
nxcomponent |
React component |
nxcomponentcss |
React component CSS module |
nxtest |
React component test |
There are several ways to install.
- Install from the Visual Studio Marketplace.
- From the VS Code Extensions view (
Ctrl+Shift+X
) or (Cmd+Shift+X
), search forVSCode React NextJS Generator
. - Run
ext install mikerheault.vscode-react-nextjs-generator
in the command palette (Ctrl+Shift+P
) or (Cmd+Shift+P
).
Setting | Description | Type | Default Value |
---|---|---|---|
reactNextjsGenerator.templates.page |
Template for Next.js page component | string |
|
reactNextjsGenerator.templates.layout |
Template for Next.js layout component | string |
|
reactNextjsGenerator.templates.error |
Template for Next.js error component | string |
|
reactNextjsGenerator.templates.loading |
Template for Next.js loading component | string |
|
reactNextjsGenerator.templates.reactComponent |
Template for React component | string |
|
reactNextjsGenerator.templates.reactComponentCss |
Template for React component CSS module | string |
|
reactNextjsGenerator.templates.reactComponentTest |
Template for React component test file | string |
|
- Generate a React Component:
- Right-click on a folder in the Explorer.
- Select
React/Next Generator > Generate React Component
. - Follow the prompts to create a new React component with SCSS module and test file.
- Generate a Next.js (Page, Loading, Layout, Error) file:
- Right-click on a folder in the Explorer.
- Select
React/Next Generator > Generate Next.js {type} File
. - Choose the desired file type (e.g.,
Page
,Loading
,Layout
,Error
).
- Use Snippets:
- Open a JavaScript or TypeScript file.
- Type the snippet prefix (e.g.,
rimr
,rfc
,nxpg
) and select the desired snippet from the suggestions.
Licensed under the MIT License.
For issues or feature requests, file an issue.