react-sponge can generate component skeleton. It will generate components in src folder of your project.
Installation
% npm i -g react-sponge
Get help
% rsg help display help for rsg
% rsg help g display help for rsg generate
rsg command
rsg g <type> <name> [-p]
Examples :
- Create class component
% rsg g c components/dropdown-menu/DropdownMenu
This code will generate the following folder structure and react class component.
your project
- src
- components
- dropdown-menu
- DropdownMenu.js
- DropdownMenu.css
Here is how DropdownMenu.js looks like.
import React, {Component} from "react";
import "./DropdownMenu.css";
class DropdownMenu extends Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
return (
<>
</>
)}
}
export default DropdownMenu;
- Create functional component
% rsg g f ShoppingList -p scss
This code will generate the following folder structure and react functional component.
your project
- src
- ShoppingList.js
- ShoppingList.scss
Here is how ShoppingList.js looks like.
import React from "react";
import "./ShoppingList.scss";
const ShoppingList = () => (
<>
</>
)
export default ShoppingList;