You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/hooks/usePaginationLimitState.ts

15 lines
404 B

import { useLocalStorage } from './useLocalStorage';
export function usePaginationLimitState(
key: string
): [number, (value: number) => void] {
const paginationKey = paginationKeyBuilder(key);
const [pageLimit, setPageLimit] = useLocalStorage(paginationKey, 10);
return [pageLimit, setPageLimit];
function paginationKeyBuilder(key: string) {
return `datatable_pagination_${key}`;
}
}