use-multi-step-form
v1.0.3
Published
Follow the instruction given bellow
Downloads
1
Readme
react-multi-step-form
Getting Started
Follow the instruction given bellow
npm install use-multi-step-form
Example
import React, { useState } from 'react'
import {useMultistepForm} from 'use-multi-step-form';
import Form1 from "./Form1";
import Form2 from "./Form2";
import Form3 from "./Form3";
const MyComponent = () => {
const {
next,
back,
step,
isLastStep,
isFirstStep
} = useMultistepForm([<Form1/>,<Form2/>,<Form3/>]);
const Submit = ()=>{
if(!isLastStep){
next()
}}
return ( <div>
{step}
{!isFirstStep &&<button onClick={back}>Back <button/>}
<button onClick={Submit}>Next <button/>
</div>
)
}