Skip to content

Instantly share code, notes, and snippets.

@alxtz
Last active October 18, 2019 08:58
Show Gist options
  • Save alxtz/6fbdc69099ca7923c918a148c74cfed8 to your computer and use it in GitHub Desktop.
Save alxtz/6fbdc69099ca7923c918a148c74cfed8 to your computer and use it in GitHub Desktop.
sample react component
import React from 'react'
class App extends React.Component {
// NOTE common fields
static propTypes = {
}
static defaultProps = {
}
state = {
}
method() {
}
fieldA = 'I am a field'
filedB = "I'm not related to the render process, so shouldn't belong to state"
// NOTE common life cycles
componentDidMount() {
}
componentWillUnmount() {
}
componentDidUpdate() {
}
render() {
}
// NOTE uncommon life cycles
shouldComponentUpdate(nextProps, nextState) {
}
static getDerivedStateFromProps(nextProps, prevState) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment