gistda-sphere-react

useMap

Access the raw map instance and Sphere API namespace

Access the raw map instance and the Sphere API namespace directly.

import { useMap } from 'gistda-sphere-react';

function MapInfo() {
  const { map, sphere, isReady } = useMap();

  if (!isReady) return <div>Loading...</div>;

  return <div>Zoom: {map.zoom()}</div>;
}

Return value

PropertyTypeDescription
mapSphereMapInstance | nullThe underlying Sphere map instance
sphereSphereNamespace | nullThe global sphere API namespace
isReadybooleantrue when the map is initialized

On this page