How to use the react-leaflet.useLeaflet function in react-leaflet

To help you get started, we’ve selected a few react-leaflet 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 conveyal / analysis-ui / lib / components / modifications-map / display.js View on Github external
export default function Display(p) {
  const bounds = useSelector(selectModificationBounds)
  const leaflet = useLeaflet()

  // Zoom to bounds on bounds change
  useOnMount(() => {
    if (bounds) leaflet.map.fitBounds(bounds)
  })

  const m = p.modification
  switch (m.type) {
    case C.REMOVE_TRIPS:
      return (
github wq / wq.app / packages / leaflet / src / overlays / EsriDynamic.js View on Github external
export default function EsriDynamic(props) {
    const leaflet = useLeaflet();
    return ;
}
github wq / wq.app / packages / leaflet / src / overlays / Wms.js View on Github external
export default function Wms(props) {
    const leaflet = useLeaflet();
    return ;
}
github wq / wq.app / packages / leaflet / src / basemaps / EsriTiled.js View on Github external
export default function EsriTiled(props) {
    const leaflet = useLeaflet();
    return ;
}
github wq / wq.app / packages / leaflet / src / overlays / EsriFeature.js View on Github external
export default function EsriFeature(props) {
    const leaflet = useLeaflet();
    return ;
}
github navtrack / navtrack / Navtrack.Core / ClientApp / src / components / library / map / Map.tsx View on Github external
function Location(props: LocationProps) {
  const { map } = useLeaflet();

  useEffect(() => {
    if (map) {
      map.panTo([props.location.latitude, props.location.longitude]);
    }
  }, [props.location, map]);

  return <>;
}
github wq / wq.app / packages / leaflet / src / basemaps / EsriBasemap.js View on Github external
export default function EsriBasemap({ layer, labels, ...rest }) {
    const leaflet = useLeaflet(),
        props = {
            ...rest,
            layer,
            leaflet
        };
    if (labels) {
        const labelProps = {
            ...props,
            layer: props.layer + 'Labels'
        };
        return (
            
                
                
            
        );
github wq / wq.app / packages / leaflet / src / components / Map.js View on Github external
function Ready() {
    const { ready } = usePlugin('map') || {},
        { map } = useLeaflet();
    useEffect(() => {
        ready && map && ready(map);
    }, [ready, map]);
    return null;
}