Last active
May 28, 2018 11:41
-
-
Save snj33v/8ae598c42948c55c1ea43911acab5868 to your computer and use it in GitHub Desktop.
public
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
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