Skip to content

Instantly share code, notes, and snippets.

@maka-io
Last active February 6, 2018 22:49
Show Gist options
  • Save maka-io/759cc912cece83fa7ff31349d256f391 to your computer and use it in GitHub Desktop.
Save maka-io/759cc912cece83fa7ff31349d256f391 to your computer and use it in GitHub Desktop.
How to load react-esri into meteor (maka)
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});
}
}
}
@maka-io
Copy link
Author

maka-io commented Nov 8, 2017

Here is the solution if you're using Meteor 1.6 and React:

    $ maka npm install --save esri-loader esri-loader-react react-arcgis

Then, in your component adapted from this solution: esri-loader-react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment