Skip to main content

MapProvider

A Context.Provider that facilitates map operations outside of the component that directly renders a Map.

The component should wrap all nodes in which you may want to access the maps:

import {MapProvider} from 'react-map-gl';

function Root() {
return (
<MapProvider>
{
// Application tree, somewhere one or more <Map /> component(s) are rendered
}
</MapProvider>
);
}

See useMap for more information.

Source

use-map.tsx