Skip to content

Instantly share code, notes, and snippets.

@apzentral
Last active January 16, 2018 23:46
Show Gist options
  • Save apzentral/30add246abb06bfa01146fa78be8a216 to your computer and use it in GitHub Desktop.
Save apzentral/30add246abb06bfa01146fa78be8a216 to your computer and use it in GitHub Desktop.
ReactJS: Skeleton for React component in ES6
import React, { Component } from "react";
// Component
class ComponentClass extends Component {
constructor(props) {
super(props);
this.state = {};
}
// render
render() {
return <div />;
}
// Life Cycle - Mounting
componentWillMount() {}
// render()
componentDidMount() {}
// Life Cycle - Updating
componentWillReceiveProps(nextProps) {}
shouldComponentUpdate(nextProps, nextState) {
return true;
}
componentWillUpdate(nextProps, nextState) {}
// render()
componentDidUpdate(prevProps, prevState) {}
// Life Cycle - Unmounting
componentWillUnmount() {}
}
export default ComponentClass;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment