UNPKG

react-use-wizard

Version:

React wizard (stepper) builder without the hassle, powered by hooks.

17 lines (12 loc) 356 B
import * as React from 'react'; import { WizardValues } from './types'; import WizardContext from './wizardContext'; const useWizard = () => { const context = React.useContext(WizardContext); if (!context && __DEV__) { throw Error('Wrap your step with `Wizard`'); } else { return context as WizardValues; } }; export default useWizard;