A CLI that let's you create boilerplate's for react components, redux files and custom hooks
Install the CLI globally. If you are Windows user, run your Command Prompt or Terminal as Administrator.
npm i -g @aliraza944/react-cli
To create a simple react file in a specific folder you have to run the following command in the root directory you your project
rc file <your-file-name> <your-file-folder>
This will create a directory for your file which will contain a <your-file-name>.jsx
file and an index.jsx
from which your file will be default exported in the specified folder. If you leave the folder empty it will create the file in the root directory of your project.
To create a component you have to run the following command in the root directory you your project
rc component <your-component-name>
This will create a components folder in you components directory. This folder will contain the <your-component-name>.jsx
file and an index.jsx
file form which your component will be default exported.
To create a component with custom hook you have to run the following command root directory you your project
rc component <your-component-name> --hook <your-hooks-dir>
This will create a components folder in you components directory. This folder will contain the <your-component-name>.jsx
file and an index.jsx
file form which your component will be default exported. It will also create a use<your-component-name>.js
file in the specified hook directory.
If you don't specify the folder for your custom hook it will create the hook in same directory of you component.
To create a custom hook you have to run the following command in the root directory you your project
rc hook <your-hook-name> [your-hooks-dir]
This will create a <your-hook-name>.js
file in the specified hooks directory. By default it will create the hook in the hooks directory if you don't specify the folder for it.