1.3.1 • Published 7 years ago

react-gc v1.3.1

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

react-gc

react-gc is A Node command line tool for quickly generating the framework of React components.

Installation

npm install react-gc -g

Install react-gc globally for use in your terminal.

Usage

New component

react-gc <filename> Creates a standard React component:

$ react-gc myComponent

//outputs myComponent.js in current directory: 

import React, {Component} from 'react';
import PropTypes from 'prop-types';

class MyComponent extends Component {
  constructor(props){
    super(props);

  }

  render(){
    return (
      <div id="MyComponent">
    
      </div>
    )
  }

}

MyComponent.propTypes = {

}

export default MyComponent;

New component in different directory

react-gc <filename> -p <path> Creates a standard React component in a new directory (or an existing one):

$ react-gc myComponent -p components

//outputs myComponent.js in ./components/myComponent.js:

import React, {Component} from 'react';
import PropTypes from 'prop-types';

class MyComponent extends Component {
  constructor(props){
    super(props);

  }

  render(){
    return (
      <div id="MyComponent">
    
      </div>
    )
  }

}

MyComponent.propTypes = {

}

export default MyComponent;

New basic component

react-gc <filename> -b Creates a standard React component in a new directory (or an existing one):

$ react-gc myComponent -b 

//outputs a myComponent.js in current directory:

import React, {Component} from 'react';
import PropTypes from 'prop-types';

const MyComponent = () => {
  return (
    <div id="MyComponent">

    </div>
  )
}

MyComponent.propTypes = {

}

export default MyComponent;

Add mapDispatchToProps or mapStateToProps

react-gc <filename> -d or react-gc <filename> -s Creates a standard React component with Redux mapDispatchToProps or mapStateToProps:

$ react-gc myComponent -d 

//outputs a myComponent.js in current directory:

import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';

class MyComponent extends Component {
  constructor(props){
    super(props);

  }

  render(){
    return (
      <div id="MyComponent">
    
      </div>
    )
  }

}

MyComponent.propTypes = {

}

function mapDispatchToProps(dispatch) {  
  return {};
}

export default connect(null, mapDispatchToProps)(MyComponent);
1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago