-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (30 loc) · 793 Bytes
/
index.js
File metadata and controls
32 lines (30 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
import { render } from 'react-dom';
import Map from './Map';
class App extends React.Component {
state = { markerPosition: { lat: 7.86824670, lng: 98.39706840 } };
moveMarker = () => {
const { lat, lng } = this.state.markerPosition;
this.setState({
markerPosition: {
lat: lat + 0.0001,
lng: lng + 0.0001,
}
});
};
render() {
const { markerPosition } = this.state;
return (
<div>
<Map markerPosition={markerPosition} />
<div>Current markerPosition: lat: {markerPosition.lat}, lng: {markerPosition.lng}</div>
<button
onClick={this.moveMarker}
>
Move marker
</button>
</div>
);
}
}
render(<App />, document.getElementById('root'));