web3-react
web3-react copied to clipboard
How to catch web3react context updates?
I need to be able to detect if the user switches account or network. I notice that the activate
function is not called when those changes happen by the user. However, I see that an Event is emitted when those changes occur. Is there a way for me to handle those events? Or, is there a way for me to set callback functions for those events?
If you grab the account
or chainId
from the useWeb3React
hook in a component that is a child of the Web3ReactProvider
, your components will get those updates.