gotangible / pages / index.jsx
index.jsx
Raw
import React, { useEffect } from "react";
import { useMoralis } from "react-moralis";
import Main from "../templates/Main";
import NftGrid from "../components/NftGrid";

const Home = () => {
  const { isWeb3Enabled, enableWeb3, isAuthenticated, isWeb3EnableLoading } =
    useMoralis();

  useEffect(() => {
    const connectorId = window.localStorage.getItem("connectorId");
    if (isAuthenticated && !isWeb3Enabled && !isWeb3EnableLoading)
      enableWeb3({ provider: connectorId });
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [isAuthenticated, isWeb3Enabled]);

  return (
    <Main>
      <NftGrid />
    </Main>
  );
};

export default Home;