class Example extends React.Component {
static getDerivedStateFromProps(nextProps, prevState) {
// ...
}