Im working on a todo aplication in react using useState, im trying to save user input and then after they click submit push it to the listArray, later to display it... I think im doing something wrong in the updateArray function, but I can seem to understand what.
import React, { useState } from "react";
function App() {
  const listArray = [""];
  const [list, updateList] = useState("");
  function handleChange(event) {
    const { name, value } = event.target;
    updateList(value);
    //console.log(list);
  }
  
  function updateArray() {
    console.log(list);
    listArray.push(list);
    console.log(listArray);
  }
  return (
    <div className="container">
      <div className="heading">
        <h1>To-Do List</h1>
      </div>
      <div className="form">
        <input name="entry" onChange={handleChange} type="text" />
        <button>
          <span onSubmit={updateArray}>Add</span>
        </button>
      </div>
      <div>
        <ul>
          <li>{listArray[0]}</li>
        </ul>
      </div>
    </div>
  );
}
export default App;
 
     
     
    
 
     
    