/** @packageDocumentation @reactapi @module react_hooks */ import { TransitionStateHookFn, HookMatchCriteria, HookRegOptions, TransitionHookFn } from '@uirouter/core'; declare type HookName = 'onBefore' | 'onStart' | 'onSuccess' | 'onError' | 'onSuccess' | 'onFinish'; declare type StateHookName = 'onEnter' | 'onRetain' | 'onExit'; /** * A React hook that registers a UI-Router Transition Hook and manages its lifecycle. * * This hook can be used to register a Transition Hook with UI-Router from a component. * The Transition Hook will be automatically de-registered when the component unmounts. * The Transition Hook will receive the current [[Transition]] object (like all Transition Hooks). * * * Example: * ```jsx * function DisallowExitUntilVerified() { * const [allowExit, setAllowExit] = useState(false); * useTransitionHook('onBefore', {}, transition => { * return allowExit; * }); * * if (canExit) { * return OK, the current state can be exited! * } * return ( *