forked from
oppi.li/claude-code
source dump of claude code
1import { useContext } from 'react'
2import type { WizardContextValue } from './types.js'
3import { WizardContext } from './WizardProvider.js'
4
5export function useWizard<
6 T extends Record<string, unknown> = Record<string, unknown>,
7>(): WizardContextValue<T> {
8 const context = useContext(WizardContext) as WizardContextValue<T> | null
9 if (!context) {
10 throw new Error('useWizard must be used within a WizardProvider')
11 }
12 return context
13}