This is the code to my [id].js - although it works… It has some issues. For instance - once visiting an id (being a collection address), visiting a different id does not work - no errors, the second id just does not load… I know I need to add a getStaticProps and getStaticpaths however when I do so I get an error in my getStaticProps regarding moralis… Would this fix the issue and if so how would I go about it in this context? Thanks
const Collection = () => {
const [nftBalances, setNftBalances] = useState([]);
const {Web3Api} = useMoralisWeb3Api();
const {isInitialized, Moralis, account,isWeb3Enabled, enableWeb3} = useMoralis()
const router=useRouter()
const id = router.query.id
console.log(account)
const fetchContract = async()=>{
const options = {
chain: "rinkeby",
address: id,
};
const nfts = await Moralis.Web3API.token.getAllTokenIds(options);
let nftBalance = nfts.result;
setNftBalances(nftBalance)
}
useEffect(() => {
if (!isInitialized && !isWeb3Enabled) {
enableWeb3()
}
else{
fetchContract()
}
}, [isInitialized] && [isWeb3Enabled])
return()