import { SetStateAction } from 'react'; /** * [state, startTransition, endTransition, isTransitioning] */ export type SimpleTransitioningState = readonly [ /** * current state value */ S, /** * startTransition * * Queue the given state transition * * Analog of React setState * * @param nextState a React setState action for this state (either a literal value or function (prev) => next) * @param isAsync if true, nextState is queued and will not be updated until endTransition is called. * Otherwise, completes all interim transitions, then the given nextState transition and rerenders the using component */ (nextState: SetStateAction, isAsync?: boolean) => void, /** * endTransition * * calling completes all queued transitions in order, sets isTransitioning to false, and rerenders */ () => void, /** * isTransitioning * * true iff this state is in the middle of a transition */ boolean ]; declare function useSimpleTransitioningState(): SimpleTransitioningState; /** * State is always a defined S if an initial state is provided */ declare function useSimpleTransitioningState(initialState: S, initialTransitioning?: boolean): SimpleTransitioningState; export default useSimpleTransitioningState;