Skip to content

Instantly share code, notes, and snippets.

@MicheleBertoli
Created September 27, 2015 13:39
Show Gist options
  • Save MicheleBertoli/0f209fd6922ebec85626 to your computer and use it in GitHub Desktop.
Save MicheleBertoli/0f209fd6922ebec85626 to your computer and use it in GitHub Desktop.
Gmaps Update
import React from 'react';
import {Gmaps} from 'react-gmaps';
const App = React.createClass({
getInitialState() {
return {
lat: 51.5258541,
lng: -0.08040660000006028
};
},
handleClick() {
this.setState({
lat: this.state.lat + 1
});
},
render() {
return (
<div>
<Gmaps
width={'50%'}
height={'500px'}
lat={this.state.lat}
lng={this.state.lng}
zoom={4} />
<button onClick={this.handleClick}>Update</button>
</div>
);
}
});
React.render(<App />, document.getElementById('gmaps'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment