Loading homepage
Build a React hook that manages navigation through a multi-step process. Expose the current step, navigation flags, and methods that respect the latest step limit.
JavaScript and TypeScript use the same contract. Tests render real React components and cover state updates and lifecycle behavior.
Input: useStep(3) Output: currentStep is 1; previous is disabled and next is available.
Input: goToNextStep() twice, then goToNextStep() again Output: Stays at step 3, with next disabled.
Input: At step 4, change maxStep from 5 to 2 Output: Clamps to step 2; increasing the limit does not restore step 4.
Examples describe state after the corresponding React render or update.