@mukundkumra/react-component-generator
v1.0.2
Published
A simple CLI tool to quickly generate React component folders with JSX and CSS files. The package scaffolds a folder with a React component template that includes imports for the CSS file and a functional component ready for editing.
Downloads
4
Maintainers
Readme
React Component Generator
A simple CLI tool for generating React components with a predefined folder structure and boilerplate code.
Features
- Easily generate React components with a single command.
- Automatically creates the necessary folder structure.
- Generates .jsx and .css files with boilerplate code.
Installation
You can either clone the git or install with npm:
Clone the repository:
git clone https://github.com/mukundkumra/react-component-generator cd react-component-generator npm link
Install the package:
npm i -g @mukundkumra/react-component-generator
Usage
To generate a React component, use the command:
gen <ComponentName>
Examples
Generate a simple component:
gen Home
This will create the following structure:
Home/ ├── Home.jsx └── Home.css
Generate a nested component:
gen Test/Home
This will create the following structure:
Test/ └── Home/ ├── Home.jsx └── Home.css
Generated File Structure
Home.jsx
import './Home.css';
import React from 'react';
function Home() {
return (
<div className="Home">
{/* Add your JSX here */}
</div>
);
}
export default Home;
Home.css
.Home {
/* Add your styles here */
}
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.