🔥🔥 Show Name on Submit Button 🔥🔥
vdsv
import React, { useState } from 'react';
const Form = () =>
{
    const [name, setName] = useState("");
    const [fullName, setFullName] = useState(name);
    const changedText = (extract) =>
    {
        console.log(extract.target.value);
        setName(extract.target.value)
    }
    const Upname = () =>
    {
        setFullName(name);
    }
    return(
        <>
        <div style={{marginTop: 150}}>
            <h1 style={{ textAlign: 'center'}}>Hello {fullName}</h1>
            <input 
                type="text" 
                style={{marginLeft : "875px"}} 
                placeholder="Enter Your Name" 
                onChange={changedText}
            />
            <br />
            <br />
            <button style={{marginLeft : "925px"}} onClick={Upname} >Submit</button>
        </div>
        </>
    );
}
export default Form;
dvdf

Comments
Post a Comment