Apply for Zend Framework Certification Training

ReactJs






  import { useState } from "react";
  function SampleForm() {
    const [name, setName] = useState("");
    const [userName, setUserName] = useState("");
    function handleChange(e) {
      setUserName(e.target.value);
    }
 
      return (
        <div>
          <form>
            <label>Your Namelabel>
            <input type="text" value={name} onChange={(e) => setName(e.target.value)placeholder="Your Name" />
            <br/>
            <label>User Namelabel>
            <input type="text" value={userName} onChange={handleChange}  placeholder="User Name" />
          form>
          <p>{name}</p>
          <p>{userName}</p>
        div>
      );
  }
 
  export default SampleForm;

< ReactJs installation React Hooks Tutorial – useState by examples >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top