New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-gc

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-gc

Simple generator for React components

latest
npmnpm
Version
1.3.1
Version published
Maintainers
1
Created
Source

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);

FAQs

Package last updated on 11 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts