score:0

data must be an array if you want to map on it, you can try to set directly data with result.data.data if it's an array, like following :

useeffect(async () => {
    let result = await loadlist();
   setdata(result.data.data);
}, []);

score:1

useeffect can not have an async callback you need to wrap it like this

useeffect(()=>{
const fetch = async () => {
    const result = await loadlist();
   setdata(result.data.data);
}
fetch();
}, []);

score:2

useeffect does not allow the use of an async function. instead you should just use the then method when calling your loadlist function and set the data in the callback.

it seems that useeffect doesn't need a dependency as it only needs to get the data on the first render, not when data changes. the latter would result in an infinite loop (update data => do something when data updates => update data)

in setdata just pass the result.data.data to update data, not within another object. otherwise the data will not be an array, but an object.

export default function list() {
  let [data, setdata] = usestate(null);

  useeffect(() => {
    loadlist().then((result) => {
      setdata(result.data.data);
    });
  }, []);

  return (
    <div>
      {data &&
        data.map((item) => (
          <div key={item.id}>
            {item.title} author: {item.author} creact time: {item.creactetime}
          </div>
        ))}
    </div>
  );
}

Related Query

More Query from same tag