Created
February 16, 2016 21:37
-
-
Save MicheleBertoli/c1bc19fc4f5b37f5c5a6 to your computer and use it in GitHub Desktop.
Re-rendering
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'; | |
import ReactDOM from 'react-dom'; | |
import {Gmaps, Marker} from 'react-gmaps'; | |
const coords = { | |
lat: 51.5258541, | |
lng: -0.08040660000006028 | |
}; | |
const App = React.createClass({ | |
handleClick() { | |
this.forceUpdate(); | |
}, | |
render() { | |
return ( | |
<div> | |
<Gmaps | |
width={400} | |
height={300} | |
lat={coords.lat} | |
lng={coords.lng} | |
zoom={12}> | |
<Marker | |
lat={coords.lat} | |
lng={coords.lng} /> | |
</Gmaps> | |
<button onClick={this.handleClick}>Re-render</button> | |
</div> | |
); | |
} | |
}); | |
ReactDOM.render(<App />, document.getElementById('gmaps')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment