1 year ago

#378305

test-img

Swati

Metamask Logout for DApp?

Suppose a user first sign in through metamask, then he instead of loggin out form dapp choses to disconnect his account from metamask itself, then in that case i want my dapp to redirect to sign in page.

I don't understand how can i implement using react js because the user can disconnect at any point when any page is shown or he is viewing any componet of react.

i know about this event listener but i don't understant how to use it, like can we make this listener global or is there some conncept of global useEffect.

ethereum.on('disconnect', () => {
        console.log("MetaMask discconnected")
}

reactjs

ethereum

use-effect

logout

metamask

0 Answers

Your Answer

Accepted video resources