A hook that invokes the provided callback whenever the current state changes.
The callback receives the StateDeclaration and parameter values of the new current state.
Example:
function ShowCurrentState() { const [routerState, setRouterState] = useState(''); useOnStateChanged((state) => setState(state.name); return <span>{routerState ? `state changed to ${routerState}` : null}</span> }
a callback that receives the new current state and parameter values
Generated using TypeDoc
A hook that invokes the provided callback whenever the current state changes.
The callback receives the StateDeclaration and parameter values of the new current state.
Example:
function ShowCurrentState() { const [routerState, setRouterState] = useState(''); useOnStateChanged((state) => setState(state.name); return <span>{routerState ? `state changed to ${routerState}` : null}</span> }