create-react-cmp
v0.3.0
Published
get component name (as snake case)
Downloads
4
Readme
Create-react-component
Work flow
- get component name (as snake case)
- create component-name folder
- inside the folder
- create index.js
- create component-name.js
- create component-name.tmpl.html
Templates
index.js
import ComponentName from './component-name';
export default ComponentName;
component-name.js stateless:
import React from 'react';
import PropTypes from 'prop-types';
import './component-name.css';
const ComponentName = () => (
<div class="component-name"></div>
);
ComponentName.propTypes = {}
or a stateful (by adding the flag -s):
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './component-name.css';
class ComponentName extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (<div className="component-name"></div>);
}
}
ComponentName.propTypes = {}
export default ComponentName;
component-name.css
.component-name{
}
Using
- commander: for controlling command line arguments.
- mustache: for compiling the templates.