loop over array and use elements in useReadContract hook #3728
vantwoutmaarten
started this conversation in
General
Replies: 1 comment 1 reply
-
https://wagmi.sh/react/api/hooks/useReadContracts#usereadcontracts |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was wondering about a common scenario, where you want to loop over an array and use the elements as an argument for useReadContract.
Since it is a hook where in a React component would you put this or in what way should this problem be tackled.
example:
const res = [];
for(e : elements){
const data = useReadContract(....args: [e]....)
res.push(data)
}
Beta Was this translation helpful? Give feedback.
All reactions