-
-
Save haytastan/693aeab705e80e917aaaa941c9b6ffe3 to your computer and use it in GitHub Desktop.
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 Map extends React.Component { | |
componentDidMount() { | |
this.map = new mapboxgl.Map({ | |
container: this.mapContainer, | |
style: 'mapbox://styles/mapbox/streets-v9' | |
}); | |
} | |
componentWillUnmount() { | |
this.map.remove(); | |
} | |
render() { | |
const style { | |
position: 'absolute', | |
top: 0, | |
bottom: 0, | |
width: '100%' | |
}; | |
return <div style={style} ref={el => this.mapContainer = el} />; | |
} | |
} | |
ReactDOM.render(<Map />, document.getElementById('app')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment