How to use the @urbica/react-map-gl.MapContext.Consumer function in @urbica/react-map-gl

To help you get started, we’ve selected a few @urbica/react-map-gl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github urbica / react-map-gl-draw / src / components / Draw / index.js View on Github external
render() {
    return React.createElement(MapContext.Consumer, {}, (map) => {
      if (map) {
        // $FlowFixMe
        this._map = map;
      }
      return null;
    });
  }
}
github urbica / react-map-gl-cluster / src / components / Cluster / index.js View on Github external
render() {
    return createElement(MapContext.Consumer, {}, (map) => {
      if (map) {
        this._map = map;
      }

      if (this.state.clusters.length === 0) {
        return null;
      }

      const clusters = this.state.clusters.map((cluster) => {
        if (cluster.properties.cluster) {
          return this._renderCluster(cluster);
        }
        const { type, key, props } = cluster.properties;
        return createElement(type, { key, ...props });
      });

@urbica/react-map-gl

React Component for Mapbox GL JS

MIT
Latest version published 2 years ago

Package Health Score

60 / 100
Full package analysis

Popular @urbica/react-map-gl functions