How to listen for account change? (Solved) #1806
Replies: 5 comments 17 replies
-
FYI You can use the following:
|
Beta Was this translation helpful? Give feedback.
-
If you happen to find a solution please also post if for everyone else |
Beta Was this translation helpful? Give feedback.
-
Hey, can you share the previous discussion you mentioned on the edit? Can't find it. |
Beta Was this translation helpful? Give feedback.
-
An even simpler solution:
|
Beta Was this translation helpful? Give feedback.
-
For now, these workarounds aren't possible for me now or are deprecated... But using the useAccountEffect({
onConnect(data) {
console.log('Connected!', data)
},
onDisconnect() {
console.log('Disconnected!')
},
}) Ref link: https://wagmi.sh/react/api/hooks/useAccountEffect#useaccounteffect |
Beta Was this translation helpful? Give feedback.
-
Is there a hook where we can detect an account change? Specifically I'd like to force a disconnect if I user switches accounts on metamask while connected on one account
--EDIT: Nevermind found in a prior discussion
Beta Was this translation helpful? Give feedback.
All reactions