@adamscybot/react-leaflet-component-marker
Version:
A tiny wrapper for react-leaflet's <Marker /> component that allows you to use a React component as a marker, with working state, handlers, and access to parent contexts.
13 lines (12 loc) • 394 B
JavaScript
import { useMemo } from 'react';
const getCoordsFromPointExpression = (expression) => {
if (!expression)
return [];
if (Array.isArray(expression)) {
return expression;
}
else {
return [expression.x, expression.y];
}
};
export const useCoordsFromPointExpression = (expression) => useMemo(() => getCoordsFromPointExpression(expression), [expression]);