Implémentation de la composante étape dans React
//1. Implementing 2 steps in Login using hashmap
// frontend\src\pages\Login\Login.jsx
import StepPhoneEmail from '../Steps/StepPhoneEmail/StepPhoneEmail';
const steps = {
1: StepPhoneEmail,
2: StepOtp,
};
const Login = () => {
const [step, setStep] = useState(1);
//select component according to step
const Step = steps[step];
function onNext() {
setStep(step + 1);
}
return <Step onNext={onNext} />;
};
Shirshak kandel