score:1

Accepted answer
function UserTransactionsComponent1() {
  const [accounts, setAccounts] = useState();

  useEffect(() => {
    async function fetchData() {
      const res = await fetch(
        "https://proton.api.atomicassets.io/atomicassets/v1/accounts"
      );
      const { data } = await res.json();
      setAccounts(data);
    }
    fetchData();
  }, []);

  const getAccounts = () => {
    if (accounts)
    return accounts?.map((result) => {
      const { account } = result;
      return account;
    })
  }


  return (
    <PageLayout>
      Hi!{" "}
      {getAccounts()}
    </PageLayout>
  );
}

export default UserTransactionsComponent1;

score:0

.then(() => accounts.map( // insert rest of function here ))

score:0

return (
  <PageLayout>{accounts ? accounts : "Loading..."}</PageLayout>
);

Related Query

More Query from same tag