score:0

maybe try something like this

  const fetchapi = async () => {
    const api = await fetch("https://randomuser.me/api");
    const json = await api.json();
    let results = json.results;
    // here you get the old data and pushing the results into data
    data.push(results)
    // and setdata to data that has (data + results)
    setdata(data);
  };

also if you want to have your data after refreshing your browser , you may need to store data in localstorage and get the initial data from that


Related Query

More Query from same tag