i am having this issue.
it looks like I can not see that image now (update: I can see it now)
import Link from ‘next/link’
import React, { useEffect, useState } from ‘react’
import { useMoralisWeb3Api } from ‘react-moralis’
const Transactions = ({user}) => {
console.log(user)
const Web3Api = useMoralisWeb3Api()
const baseUrl = ‘https://ropsten.etherscan.io/tx/’
const [ transactions, setTransactions] = useState()
const fetchTransactions = async () => {
const data = await Web3Api.account.getTransactions({
chain :‘ropsten’,
address: user.get(‘ethAddress’)
}).catch(e => console.error(e))
if (data) {
setTransactions(data.result)
}
console.log("data :" , data)
}
useEffect(() => {
fetchTransactions()
}, [])
return (
{transactions && transactions.map((transaction) => {
<Link href={
${baseUrl}${transaction.hash}
}> {transaction.hash}})}
)
}
export default Transactions
@cryptokid you can see the whole code here.
user isnt defined
This isnt how it is supposed to be done, if you dont mind pls take a look at the docs here
The user is imported from a hook
const {...,user} = useMoralis();
i tried this way too.
still this issue occur only in this component
i dont understand why.
import { useMoralis, useMoralisWeb3Api } from 'react-moralis'
const {user} = useMoralis()
if you dont mind, take a looks at the docs and remove any where user
is been created, not to have conflicts, hooks are state variables and can be used throughout the script