Hi!
Server URL: https://fy10aag9l5fn.grandmoralis.com:2053/server
Probably it can be a logic error, this code worked well and all of the sudden started to retrieve - âTypeError: data is nullâ.
Even with âisLoading ifâ, suggested by Dmitry Yomoo in discord problem remains.
import { useMoralis, useMoralisCloudFunction } from "react-moralis";
import { Box, Container, Text } from "@chakra-ui/react";
import { ErrorBox } from "./Error";
const UniqueNFTOwners = () => {
// https://github.com/MoralisWeb3/react-moralis#usemoraliscloudfunction
const { data, error, isLoading } = useMoralisCloudFunction("uniqueNFTOwners");
if (!isLoading) {
console.log(JSON.stringify(data[0].NFT_UniqueOwners));
return (
<Container>
{error != null ? (
<ErrorBox title="Cloud function has failed" />
) : (
<Text>
Unique NFT Owners: {JSON.stringify(data[0].NFT_UniqueOwners)}
</Text>
)}
</Container>
);
}
};
export const Home = () => {
const { authenticate, isAuthenticated } = useMoralis();
return (
<Box>
<UniqueNFTOwners />
</Box>
);
};
Help is needed!
Thanks in advance.
Best regards,
JoĂŁo Moreira