@comparaonline/ui-wizard-form-history-listener
v2.2.6
Published
An utility intended to be used in conjunction with `WizardForm` to manage the URL changes.
Downloads
60
Maintainers
Keywords
Readme
@comparaonline/ui-wizard-form-history-listener
An utility intended to be used in conjunction with WizardForm
to manage the URL changes.
By convention, the navigation using the browser controls (back, forward and address input) is limited to backward only. The forward navigation is replaced to the current active step.
Installation
yarn add @comparaonline/ui-wizard-form-history-listener
Usage
import { QuoteFormHistoryListener } from '@comparaonline/ui-wizard-form-history-listener';
const QuoteForm: React.FunctionComponent<Props> = ({ handleSubmit }) => (
<WizardFormManager<Partial<FormValues>>>
{({ onSubmit, initialValues, ...props }) => (
<>
<WizardForm
{...props}
formProps={{
onSubmit,
initialValues
}}
/>
<QuoteFormHistoryListener route="/:id/:stepId" {...props} />
</>
)}
</WizardFormManager>
);