score:1

Accepted answer
useEffect(() => {
  fetch(SERVER_URL + "salesmen/1")
    .then((response) => response.json())
    .then((data) => {
      // fruits: responseData
      const fruitdata = data.inventory.map((p) => {  // mapping on invenroty will resolve the issue
        return {
          inventory: p.inventory,
          theDate: p.inventory.theDate,
          description: p.inventory.descrip,
        };

      });
      console.log(fruitdata)
     setfruits(fruitdata);

      
    })
    .catch((err) => console.error(err));
}, []);

Related Query

More Query from same tag