useWizard.js
18 lines
| 1 | /* eslint-disable import/no-extraneous-dependencies */ |
| 2 | import { useContext } from '@wordpress/element'; |
| 3 | |
| 4 | /** |
| 5 | * Internal Dependencies |
| 6 | */ |
| 7 | import WizardContext from './wizardContext'; |
| 8 | |
| 9 | export default function useWizard() { |
| 10 | const context = useContext(WizardContext); |
| 11 | |
| 12 | if (!context) { |
| 13 | throw Error('Wrap your step with `Wizard`'); |
| 14 | } |
| 15 | |
| 16 | return context; |
| 17 | } |
| 18 |