useStableMemo

    API

    import useStableMemo from '@restart/hooks/useStableMemo'
    • useStableMemo<T>(factory: () => T, deps?: DependencyList) => T

      Identical to useMemo except that it provides a semantic guarantee that values will not be invalidated unless the dependencies change. This is unlike the built in useMemo which may discard memoized values for performance reasons.

      Parameters

      • factory() => T

        A function that returns a value to be memoized

      • deps?DependencyList

        A dependency array

      Return Value T