Last active
February 6, 2018 22:49
-
-
Save maka-io/759cc912cece83fa7ff31349d256f391 to your computer and use it in GitHub Desktop.
How to load react-esri into meteor (maka)
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, { Component } from 'react'; | |
import EsriLoader from 'esri-loader-react'; | |
import { Map } from 'react-arcgis'; | |
class EsriMapComponent extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
loaded: false | |
}; | |
} | |
render() { | |
const options = { | |
url: 'https://js.arcgis.com/4.6/' | |
}; | |
return ( | |
<div> | |
<EsriLoader options={options} ready={this.onEsriApiLoaded}/> | |
{ this.state.loaded ? | |
<Map style={{ height: '95vh', width: '95vw'}}/> : null } | |
</div> | |
); | |
} | |
onEsriApiLoaded = (error) => { | |
if (!error) { | |
this.setState({loaded: true}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the solution if you're using Meteor 1.6 and React:
Then, in your component adapted from this solution: esri-loader-react