Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check web3 metamask disconnect

// The following code snippet is in React
// but you can use the window.ethereum.on("accountsChanged") event 
// in regular JavaScript

// Note: I believe window.ethereum is only available if using Metamask 
// as your web3 provider

useEffect(() => {
    window.ethereum.on("accountsChanged", accounts => {
      if (accounts.length > 0) setAccount(accounts[0]);
      else setAccount("");
    });
}, []);
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery moment js 
Javascript :: splice method in javascript 
Javascript :: javascript first letter uppercase 
Javascript :: capitalize each word from string in react 
Javascript :: How to add a class to html element js 
Javascript :: vue component lifecycle 
Javascript :: change array index position in javascript by up and down click 
Javascript :: dull or blur a background image in react native 
Javascript :: array.push 
Javascript :: how to use json stringify in javascript 
Javascript :: react native style variable 
Javascript :: js get screen width 
Javascript :: chrome block javascript alert 
Javascript :: overflowy javascript 
Javascript :: getmonth js 
Javascript :: how to remove first element from array in javascript 
Javascript :: javascript remove css link 
Javascript :: how to set selected value of dropdown in javascript 
Javascript :: js map array to object 
Javascript :: difference between ajax and node js 
Javascript :: connect mongodb using mongoose in node js 
Javascript :: selected text 
Javascript :: multi-dimensional array js 
Javascript :: how to create a slice of the array with n elements taken from the beginning in javascript 
Javascript :: for of in js or for in loop in js 
Javascript :: import javascript 
Javascript :: discord.js if no arguments 
Javascript :: global execution context javascript 
Javascript :: findone and update mongoose 
Javascript :: js initialize 2d array 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =