I am using create-react-app
. Is there a command to create a component to scaffold the files.
Right now I am manually creating the files. Say if the component name is Button
, I create a folder named Button inside the component folder and then create Button.js
and Button.css
files.
Is there any CLI commands to do this using create-react-app? I know there is a way to do this Angular CLI but don't know anything with React CLI.
You may use directly without installing the generate-react-cli
npx generate-react-cli component MyComponent
Which will install a component based on your project preferences (ex: typescript, scss, etc..).
A file called generate-react-cli.json
will be created where all the settings will be stored for future use.