UNPKG

@resourge/react-fetch

Version:

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

35 lines (34 loc) 1.18 kB
/** * react-fetch v1.41.3 * * Copyright (c) resourge. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import { type ElementWithScrollTo } from '../useOnScroll/useOnScroll'; /** * Method to restore scroll. * If return `ref` is not set, it will assume window * @param scrollRestorationId * @example * ```Typescript // useAction will probably be from a navigation/router package // Ex: import { useAction } from '@resourge/react-router'; const action = useAction(); // 'action' must be 'pop' for restoration to work; const [scrollRestoration, ref] = useScrollRestoration(action); const [data, fetch, error] = useFetch( async () => { return HttpService.get("url") }, { initialState: [], scrollRestoration } ); ``` */ export declare const useScrollRestoration: <T extends ElementWithScrollTo | null>(action: "pop" | string, scrollRestorationId?: string) => readonly [(behavior?: ScrollBehavior) => void, import("react").MutableRefObject<T>, (event: import("react").UIEvent<T, UIEvent>) => void];