• Register

COMPONENT : 

import React from "react"

 

class InputForm extends React.Component{

    state = {

        email : "",

        password : ""

    }

 

    render(){

        return(

            <>

                <input placeholder="Email" type="email" onChange={(e) => this.setState({ email : e.target.value })} />

                <input placeholder="Password" type="password" onChange={(e) => this.setState({ password : e.target.value })} />

            </>

        )

    }

}

HOOKS : 

import React, { useState } from "react"

 

const InputForm = () => {

 

    const [email, setEmail] = useState("");

    const [password, setPassword] = useState("");

 

    return(

        <>

            <input placeholder="Email" type="email" onChange={(e) => setEmail(e.target.value)} />

            <input placeholder="Password" type="password" onChange={(e) => setPassword(e.target.value)} />

        </>

    )

}

 

100 points
3