0.2.0 • Published 2 years ago

react-wizard-provider v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-wizard

This library solves wizard problem by providing wizard functionality handlers.

Example

import { ReactWizard, HandlersProps } from 'react-wizard-provider';

const Handlers = ({
  handleStepBack,
  handleStepForward,
  currentStep,
  totalSteps,
}: HandlersProps) => (
  <>
    <button type="button" onClick={handleStepBack} disabled={currentStep === 1}>
      Back
    </button>
    {totalSteps === currentStep ? (
      <button type="submit">Submit</button>
    ) : (
      <button type="button" onClick={handleStepForward}>
        Forward
      </button>
    )}
  </>
);

export const App: React.VFC = () => (
  <ReactWizard handlers={Handlers}>
    <div>Step 1</div>
    <div>Step 2</div>
    <div>Step 3</div>
  </ReactWizard>
);