@theoplayer/react-native-ui
Version:
A React Native UI for @theoplayer/react-native
13 lines • 745 B
TypeScript
/**
* A throttled version of React's `useState` that limits how often the state is updated.
*
* When `setValue` is called repeatedly, the state will update immediately if enough time
* has passed since the last update. Otherwise, it schedules an update after the remaining
* throttle interval. The most recent value is always applied eventually (trailing flush).
*
* @param initialValue The initial state value.
* @param intervalMs The minimum interval (in milliseconds) between state updates.
* @returns A tuple of `[state, setValue]`, just like `useState`.
*/
export declare function useThrottledState<T>(initialValue: T, intervalMs: number): [T, (value: T, forced?: boolean) => void];
//# sourceMappingURL=useThrottledState.d.ts.map