Template when generating react mobx using generate-react-template in VSCode
Usage refers to https://marketplace.visualstudio.com/items?itemName=joshjg.generate-react-component
- Install the extention of VSCode first: ext install generate-react-component.
- Clone this project into your local workspace.
- Change the config "generate-react-component.componentTemplatePath" in VSCode preference (Keyboard shortcuts: cmd + ,)to the path of this project in your local drive.
- Change "generate-react-component.conditionals" if you added additional condition.
- Right click any directory in the explorer panel.
- Select component or container.
- Input name and choose options.
- Submit and happy coding.
Template syntax is very simple:
Any occurrence of ComponentName in a filename or a file's content will be replaced with the user's text input. Any text surrounded by /* IF condition / and / ENDIF /, where condition is the name of an option (definted in the package settings) will be removed unless condition is enabled (or invalid) Any text surrounded by / IF !condition / and / ENDIF / will be removed unless condition is disabled (or invalid) Any remaining / IF / or / ENDIF */ comments will be removed, but the text between them will be untouched