Skip to content

Lesson 10: Trouble understanding destruct pattern with useWeb3Contract #1423

Answered by iangechuki
0xCardiE asked this question in Q&A
Discussion options

You must be logged in to vote

when we say

 const {runContractFunction: enterRaffle}=useWeb3Contract({})

we are getting runContractFunction from useWeb3Contract hook.But lets say there are other five functions that are going to interact with the contract in this same page they will have the same name of runContractFunction,so we rename it to enterRaffle.so from now our function will no longer be called runContractFunction .It will be enterRaffle.

Another example is:

let users={
name:"John",
address:2
}
//if we want the name we will say
let {name}=users
//if we want to be more explicit we will change name to username.like this:
let {name:username}=users
//when destructuring basically we are getting the individual item i…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@0xCardiE
Comment options

Answer selected by 0xCardiE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants