Search code examples
javascriptreactjscreate-react-app

Best way to create new React component using create-react-app


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.


Solution

  • 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.