Skip to content

Instantly share code, notes, and snippets.

@snj33v
Last active May 28, 2018 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snj33v/8ae598c42948c55c1ea43911acab5868 to your computer and use it in GitHub Desktop.
Save snj33v/8ae598c42948c55c1ea43911acab5868 to your computer and use it in GitHub Desktop.
public
class MapView extends React.Component {
constructor(props) {
super(props)
this.state = {
center: 0
}
}
static getDerivedStateFromProps (props, state) {
// both props.right and props.left are simple numerical values
let feat = props.right+ props.left
return ( {
center:feat,
})
}
checkState = () => {
<div>{this.state.center}</div>
}
render() {
return (
<div>
{
this.checkState()
}
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment