react-init-class
v1.0.7
Published
A Simple npm module to create a react init class with a default constructor and render methods. It will create a class with the file name provided by -f parameter and in the path provided by -p parameter.
Downloads
13
Maintainers
Readme
react-init-class
A Simple npm module to create a react init class with a default constructor and render methods. It will create a class with the file name provided by -f <className (or) fileName> parameter and in the path provided by -p </path/to/dir> parameter.
You can install the module by runnning:
npm install react-init-class
Usage:
You can use the module by running: react-init-class -f <fileName/className> -p </path/to/dir>
Eg: react-init-class -f SampleComponent -p '~/Desktop/Test'
This will create a SampleComponent.js file in ~/Desktop/Test/SampleComponent.js.
SampleComponent.js file will be created as below:
import React, { Component as ReactComponent } from 'react';
class SampleComponent extends ReactComponent {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (
<div></div>
);
}
}
export default SampleComponent;