asdsad

import React, {useState} from “react”;

//React – allows to build UI components
//useState – to manage component’s state – Form Data

function RegistrationForm(){
    const[formData, setFormData] = useState({
        firstName:” “,
        lastName:” “,
        email:” “,
        password:” “,
        gender:” “,
        hobbies:[],
        country:” “,
        bio:” “,
        agreeToTerms: false;
    }
    );
}

import {useState} from “react”;
function SimpleForm()
{
    const[name, setName] = useState(“”);
    //useState – Store the name
    const handleChange = (e) => {
        setName(e.target.value);
        //Update teh state as user types
    };
    const handleSubmit = (e) => {
        e.preventDefault();
        alert(‘Form has been submitted: ${name}’)

    };
    return(
        <form>
            <label>
                Name:
                <input type=“text” value={name} onChane={handleChange}>
            </label>
            <button type=“submit”>submit</button>
        </form>
    )

}
export default SimpleForm;
Scroll to Top