score:0

  const currList = useRef([]);

useEffect=(()=>{
const fetchShips = async () => {
    const response = await request(gql`
      {
        ships {
          name
          home_port
          image
        }
      }
    `);
    console.log("request response", response.data);
     // setCurrList(response.data);
if(response)
    currlist.current = response.data

    console.log("currlist:", currList);
  };
fetchShips()
// Also as far as I know ,you should use useEffect like this
},[])
//... codes

return(
//... codes
 currList.current.map(...

)
//... codes

score:1

useEffect(() => {
    console.log("List is updated", currList);
}, [currList]);

Related Query

More Query from same tag