@resourge/react-fetch
Version:
[](LICENSE)
36 lines (35 loc) • 1.27 kB
TypeScript
/**
* react-fetch v1.43.1
*
* 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 VisitedUrl } from './useOnScroll/types';
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 useBaseScrollRestoration: <T extends ElementWithScrollTo | null>(visitedUrl: Map<string, VisitedUrl>, action: "pop" | string, scrollRestorationId?: string) => readonly [(behavior?: ScrollBehavior) => void, import("react").MutableRefObject<T>, (event: import("react").UIEvent<T, UIEvent>) => void];