Last active
October 18, 2019 08:58
-
-
Save alxtz/6fbdc69099ca7923c918a148c74cfed8 to your computer and use it in GitHub Desktop.
sample react component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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