- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
React Snippets
        Nick S. Plekhanov edited this page Sep 8, 2016 
        ·
        1 revision
      
    import React from 'react';
import { render } from 'react-dom';
import React, { Component, PropTypes } from 'react';
export default class ${1:NewComponent} extends Component {
  static propTypes = {
    $2
  };
  render() {
    return (
      ${3:<div>${1:NewComponent} Content</div>}
    );
  }
}
import React, { PropTypes } from 'react';
const ${1:NewComponent} = (props) => {
  return (
    <div>${3:${1:NewComponent} Content}</div>
  );
};
${1:NewComponent}.propTypes = {
  propName: PropTypes.$2
};
export default ${1:NewComponent};
constructor(props) {
  super(props);
  ${1}
}
render() {
  return (
    ${1:<div></div>}
  );
}
this.${1} = this.${1}.bind(this);
this.${1} = ::this.${1};
componentWillMount() {
  $1
}
componentDidMount() {
  $1
}
componentWillReceiveProps(nextProps) {
  $1
}
componentWillUnmount() {
  $1
}
shouldComponentUpdate(nextProps, nextState) {
  $1
}
${1:myProp}: PropTypes.any${2:,}
${1:myProp}: PropTypes.any.isRequired${2:,}
${1:myProp}: PropTypes.string${2:,}
${1:myProp}: PropTypes.string.isRequired${2:,}
${1:myProp}: PropTypes.number${2:,}
${1:myProp}: PropTypes.number.isRequired${2:,}
${1:myProp}: PropTypes.object${2:,}
${1:myProp}: PropTypes.object.isRequired${2:,}
${1:myProp}: PropTypes.array${2:,}
${1:myProp}: PropTypes.array.isRequired${2:,}
${1:myProp}: PropTypes.bool${2:,}
${1:myProp}: PropTypes.bool.isRequired${2:,}
${1:myProp}: PropTypes.element${2:,}
${1:myProp}: PropTypes.element.isRequired${2:,}
${1:myProp}: PropTypes.func${2:,}
${1:myProp}: PropTypes.func.isRequired${2:,}
${1:myProp}: PropTypes.oneOf([$2])${3:,}
${1:myProp}: PropTypes.oneOf([$2]).isRequired${3:,}
${1:myProp}: PropTypes.oneOfType([$2])${3:,}
${1:myProp}: PropTypes.oneOfType([$2]).isRequired${3:,}
PropTypes.shape({
  $1
})${2:,}
PropTypes.shape({
  $1
}).isRequired${2:,}
this.state = {
  $1
};
this.state.$1
this.setState({
  $1: $2
});
static defaultProps = {
  ${1:propName}: ${2:0}${3:,}
};
this.props.$1
static propTypes = {
  ${1:propName}: PropTypes.${2}${3:,}
};