Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

implementating step component in react

//1. Implementing 2 steps in Login using hashmap
// frontendsrcpagesLoginLogin.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} />;
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: redis json get multiple paths 
Javascript :: chrome inspector console tips 
Javascript :: how to make my website source file not accessible in inspectot 
Javascript :: javascript function description standards 
Javascript :: jquery add disabled to id 
Javascript :: run js function after some sec 
Javascript :: loopback unique field 
Javascript :: dummy json 
Javascript :: js add seconds to current time 
Javascript :: react useref file input 
Javascript :: jquery selected label option 
Javascript :: javascript date to string 
Javascript :: regex replace cpf 
Javascript :: bjsmasth 
Javascript :: js distance from top 
Javascript :: get the middle character js 
Javascript :: convert hex to decimal javascript 
Javascript :: getelementbytagname js 
Javascript :: how to implement toastr 
Javascript :: how much html and css before javascript 
Javascript :: how to change the query parameter of the url in javascript 
Javascript :: express serve static files 
Javascript :: array of characters to stirng javascript 
Javascript :: view all local storage js 
Javascript :: angular usehash not working 
Javascript :: cypress type force 
Javascript :: geolocation in javascript 
Javascript :: search by date interval mongoose 
Javascript :: email validation in react js 
Javascript :: angular command to create interceptor 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =