Generate React components in current execute directory by typing with CLI.
- Create a basic components with ts / js config.
- Follow the practice of react official ts / js docs.
- Generate Components / Slice / useState in one line.
- No configs, easy to use with prompts.
npm i -g react-generate-comp
Generate Components
rgc <typescript Flag> -c <Components name>
rgc <typescript Flag> -c <Components name>
Generate RTK Slice
rgc <typescript Flag> -s <Slice name>
<typescript Flag>
-t, --typescript For enable typescript tsx generate
<react native Flag>
-n, --native For generate react native components
<Components name>
-c, --generateComp for Generate comp name
<Slice name>
-s, --generateRTKSlice Generate RTK slice
<useState name>
-u, --generateUseState Generate useState line code to your clipboard
Usage:
Create a tsx components named "HelloComp" for `React`
rgc -t -c "helloComp"
rgc -tc "helloComp"
Create a jsx components named "Yolocomp" for `React`
rgc -c "yolocomp"
Create a tsx components named "HelloComp" for `React native`
rgc -t -n -c "helloComp"
rgc -tnc "helloComp"
Create a jsx components named "Yolocomp" for `React native`
rgc -n -c "yolocomp"
rgc -nc "yolocomp"
Create a jsx RTK Slice named "NotTodoSlice"
rgc -s "notTodo"
Create a useState named with "[ number, setNumber ]"
rgc -u number
Create a set of folder and file for init the new Vite / CRP project
rgc --init
rgc -t -c "testComp"
or rgc -tc "testComp"
Template
rgc -c "hiComp"
Template
rgc -t -s "todo"
or rgc -ts "todo"
Template
rgc -s "todo"
Template
- First class typescript support
- Generate other related stuff
- Init more template
- Add react native component generate
-n
flag
- Add zustand template to
rgc --init
- Cli '-c', '-s' will not overwrite file that already exist in the current path.
init project javascript
will not generate interface folder from now.
- Added
rgc --init
prompt features. - Added RTK generate in init project features.
- Fixing bug on prompt cancel issues.
- Fixing RTKSlice Ts spacing issues.
- Better reminder prompt.
- Added
rgc --init
functions for init project folder data.
- Updated generate log syntax.
- Now typing
rgc
will active a prompts interface to select regarding generate stuff. - Color log improvement.
- Added
rgc -u <setState_name>
generate function.