MCPcopy
hub / github.com/PaulLeCam/react-leaflet / usePathOptions

Function usePathOptions

packages/core/src/path.ts:14–30  ·  view source on GitHub ↗
(
  element: LeafletElement<FeatureGroup | Path>,
  props: PathProps,
)

Source from the content-addressed store, hash-verified

12}
13
14export function usePathOptions(
15 element: LeafletElement<FeatureGroup | Path>,
16 props: PathProps,
17) {
18 const optionsRef = useRef<PathOptions | undefined>(undefined)
19
20 useEffect(
21 function updatePathOptions() {
22 if (props.pathOptions !== optionsRef.current) {
23 const options = props.pathOptions ?? {}
24 element.instance.setStyle(options)
25 optionsRef.current = options
26 }
27 },
28 [element, props],
29 )
30}
31
32export function createPathHook<
33 E extends FeatureGroup | Path,

Callers 2

path.tsFile · 0.90
createPathHookFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…