
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
@ubilabs/mapbox-react-hooks
Advanced tools
This is a JavaScript library to easily implement a Mapbox map into your React application. It comes with a collection of React hooks to access the Mapbox map instance all over your components and to handle some common interactions with the map.
You need to have React 16.8.0 or later installed to use the Hooks API.
npm install @ubilabs/mapbox-react-hooks -S
Import the MapProvider
and wrap it around your components.
Make sure all components that should have access to the Mapbox map instance
are nested inside of the MapProvider
.
import React, {useState, useCallback, forwardRef} from 'react';
import {MapProvider} from '@ubilabs/mapbox-react-hooks';
const MapCanvas = React.forwardRef((props, ref) => (
<div ref={ref} />
));
function App() {
const [mapContainer, setMapContainer] = useState(null);
const mapRef = useCallback((node) => {
node && setMapContainer(node);
}, []);
return (
<MapProvider
mapContainer={mapContainer}
config={{
accessToken: MAPBOX_ACCESS_TOKEN,
...
}}
onLoad={(map) => {/* Do something with the map */}}
>
<React.StrictMode>
<MapCanvas ref={mapRef} />
</React.StrictMode>
</MapProvider>
);
}
export default App;
The MapProvider
makes the Mapbox map instance available to any nested components with the useMap
hook.
import React from 'react';
import {useMap} from 'mapbox-react-hooks';
const MyComponent = () => {
const mapInstance = useMap();
// Do something with the Mapbox map instance
return (...);
};
A provider component to wrap around all components that should have access to the Mapbox map instance. (read more)
React hook to get the map instance. (read more)
React hook to add sources and layers to the map instance and to properly clean them up. The sources will be updated with new data without reapplying all layers again. (read more)
React hook to handle a click on a map layer. (read more)
React hook to handle a hover over a map layer. (read more)
npm publish --access public
FAQs
React hooks and map context provider for Mapbox
The npm package @ubilabs/mapbox-react-hooks receives a total of 5 weekly downloads. As such, @ubilabs/mapbox-react-hooks popularity was classified as not popular.
We found that @ubilabs/mapbox-react-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.