
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
generate-react-cli
Advanced tools
To help speed up productivity in React projects and stop copying, pasting, and renaming files each time you want to create a new component.
A few notes:
npm i -g generate-react-cli
generate-react component Box
npx generate-react-cli component Box
(npx is a package runner tool that comes with npm 5.2+ and higher)
When you run generate-react-cli within your project the first time, it will ask you a series of questions to customize the cli for your project needs (this will create a "generate-react-cli.json" config file).
{
"component": {
"path": "src/components",
"css": {
"preprocessor": "css",
"module": false,
"withStyle": true
},
"test": {
"library": "Testing Library",
"withTest": true
},
"withStory": false,
"withLazy": false
},
"usesTypeScript": false
}
npx generate-react-cli component Box
This command will create a folder with your component name within your default (e.g. src/components) directory, and its corresponding files.
|-- /src
|-- /components
|-- /Box
|-- Box.js
|-- Box.css
|-- Box.test.js
You can also override some of the generate-react-cli default config options for one-off commands. So for example, let's say you have set withTest to be true
in your generate-react-cli config file. You can override it for that one-off command like this:
npx generate-react-cli c Box --withTest=false
Or vice versa, if you have set withTest to be false
you can do this:
npx generate-react-cli c Box --withTest=true
Otherwise, if you don't pass any options, it will just use the default values from the generate-react-cli config file you have set.
Options | Description | Value Type |
---|---|---|
--path | Value of the path where you want the component to be generated in (e.g. src/pages). | String |
--withStyle | Creates a corresponding stylesheet file with this component. | Boolean |
--withTest | Creates a corresponding test file with this component. | Boolean |
--withStory | Creates a corresponding story file with this component. | Boolean |
--withLazy | Creates a corresponding lazy file (a file that lazy-loads your component out of the box and enables code splitting) with this component. | Boolean |
Generate React CLI is open source software licensed as MIT.
FAQs
A simple React CLI to generate components instantly and more.
The npm package generate-react-cli receives a total of 7,592 weekly downloads. As such, generate-react-cli popularity was classified as popular.
We found that generate-react-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.