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 can use https://www.npmjs.com/package/generate-react-component for this,
this will help you to create state and stateless component also known as functional and class components.
Another way is to create files manually and use snippets to generate the code.
For example, take a look at this JavaScript/React VS Code extension. You can also create your own snippets or find other extensions if you were interested.