MCPcopy Create free account
hub / github.com/TanStack/table / useSkipper

Function useSkipper

examples/react/kitchen-sink/src/hooks.tsx:3–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import React from 'react'
2
3export function useSkipper() {
4 const shouldSkipRef = React.useRef<boolean | null>(true)
5 const shouldSkip = shouldSkipRef.current
6
7 // Wrap a function with this to skip a pagination reset temporarily
8 const skip = React.useCallback(() => {
9 shouldSkipRef.current = false
10 }, [])
11
12 React.useEffect(() => {
13 shouldSkipRef.current = true
14 })
15
16 const result = React.useMemo(
17 () => [Boolean(shouldSkip), skip] as const,
18 [shouldSkip, skip],
19 )
20
21 return result
22}

Callers 1

AppFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected