title: Is there any alternative to access event.target from a react functional component?
body: <p>I'm creating a form and taking input from a mui textfield. I stored the value of the textfield to a value object. I created an onValueChanged function to store the key and value of the form fields. I want to show the current value in textfield and save it to the useState constant value. Is there any alternative method to achieve that? What is the basic structure of event.target?</p>
  <p>It is giving an error that</p>
  <pre><code> TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
  TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
  </code></pre>
  <p><a href="https://i.stack.imgur.com/YSQcy.png" rel="nofollow noreferrer">Image of the form</a></p>
  <p>The snippet for the code is -</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const [value, setValue] = React.useState({
      practiceSetName: "",
      grade: "",
      subject: "",
      level: "",
      correctMarks: "",
      topic1: "",
      topic2: "",
      topic3: "",
      incorrectMarks: "",
      timeLimit: "",
      exam: "",
      difficultyLevel: "",
      instructions: "",
      questions: "",
    });
  
    const handleChange = (event) =&gt; {
      const [name, value] = event.target; //this line is giving error
  
      setValue(...value, ([name] = value));
      preferences = value;
      console.log("changed Data");
      console.log(value);
      console.log(value.questions);
      handleClose();
    };
    </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>   &lt;TextField
                        autoFocus
                        margin="dense"
                        required
                        id="name"
                        label="Practise Set Name"
                        value={value.practiceSetName}
                        type="string"
                        fullWidth
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        required
                        id="grade"
                        value={value.grade}
                        label="Grade"
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="subject"
                        value={value.subject}
                        label="Subject"
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="topic1"
                        value={value.topic1}
                        label="Topic 1"
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="timeLimit"
                        value={value.timeLimit}
                        label="Time limit in minutes"
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="topic2"
                        label="Topic 2"
                        value={value.topic2}
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="topic3"
                        label="Topic 3"
                        value={value.topic3}
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        required
                        margin="dense"
                        id="level"
                        label="Difficulty level"
                        value={value.level}
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="exam"
                        label="Exam"
                        value={value.exam}
                        variant="standard"
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="instructions"
                        label="Instructions"
                        value={value.instructions}
                        variant="standard"
                        multiline
                        fullWidth
                        maxRows={4}
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="correctMarks"
                        label="Marks for correct answer"
                        variant="standard"
                        value={value.correctMarks}
                        onChange={handleChange}
                      /&gt;
                      &lt;TextField
                        autoFocus
                        margin="dense"
                        id="wrongMarks"
                        label="Marks for incorrect answer"
                        variant="standard"
                        value={value.incorrectMarks}
                        onChange={handleChange}
                      /&gt;</code></pre>
  </div>
  </div>
  </p>