UNPKG

@vis.gl/react-google-maps

Version:

React components and hooks for the Google Maps JavaScript API

12 lines (8 loc) 236 B
import {useRef} from 'react'; export function useMemoized<T>(value: T, isEqual: (a: T, b: T) => boolean): T { const ref = useRef<T>(value); if (!isEqual(value, ref.current)) { ref.current = value; } return ref.current; }