react-toolbox-cli
v1.0.2
Published
CLI to generate react components
Downloads
2
Maintainers
Readme
react-component-cli
CLI to generate React components
#Usage: rc generate
Options:
-p --pure [condition] Pure component
-e --extension [js|jsx|ts|tsx] Component extension
-s --style [css|scss] Component style extension
-h, --help output usage information
#Example: rc generate Header
Will generate a Header folder and Header.js
import React, {Component} from 'react';
import PropTypes from 'prop-types';
class Header extends Component{
state = {};
render() {
return(
<div>Header component</div>
)
}
}
Header.propTypes = {
};
export default Header;
#Example: rg generate Header -s scss
Will generate a Header folder with Header.js and Header.scss
#####Header.js
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import './Header.css'
class Header extends Component{
state = {};
render() {
return(
<div className="header-component">
Header component</div>
)
}
}
Header.propTypes = {
};
export default Header;
#####Header.scss:
.header-component {}
#Example rc generate Header -p
#####Header.js
import React from 'react';
import PropTypes from 'prop-types';
const Header = (props) => {
return(
<div>Header component</div>
)
};
Header.propTypes = {
};
export default Header;
#Info
You can also combine --pure and --style and --extension
rc generate Header -p -s scss
rc generate Header -p -s css -e ts