Last active
August 23, 2020 13:07
-
-
Save tristen/5c4b346ae38892f732504e6785d87057 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Should
be
(Add an
=
)?