title: adding to an array using useState using the input value - React
body: <p>I'm really close to achieving the final goal. My goal is to add X and the name of X is the input's value. I just want a little help that why the function isn't working(I'm sure the method is true). I would appreciate it if you explain it so I can find it myself.</p>
  <p><strong>Function:</strong></p>
  <pre><code>const [activityNames, setName] = useState([
      { id: 1, name: 'Feel free to add, edit and delete!' }
  ]);
  const handleSetName = e =&gt; {
      const name = {
          id: Math.random() * 10000,
          name: e.target.value
      };
      let names = activityNames.concat(name)
      setName(names);
  };
  </code></pre>
  <p><strong>Input:</strong></p>
  <pre><code>&lt;input type=&quot;text&quot; placeholder=&quot;Aktivitätsname&quot; value={activityNames.name} /&gt;
  &lt;button onClick={handleSetName}&gt;
      &lt;i className=&quot;fas fa-plus&quot;&gt;&lt;/i&gt;
  &lt;/button&gt;
  </code></pre>