Search code examples
javascriptethereumweb3js

object helper methods using react-moralis


How do I log out of a wallet using Moralis?

This allowed me to log in:

<button className="button-connect" 
    onClick={() => enableWeb3({provider: 'Current Provider'})} 
    disabled={isWeb3EnableLoading}>
    Connect Wallet
</button>

Solution

  • useMoralis hook seems to be coming with the logout function:

    const LogoutButton = () => {
      const { logout, isAuthenticating } = useMoralis();
    
      <button onClick={() => logout()} disabled={isAuthenticating}>
        Authenticate
      </button>;
    };
    

    https://www.npmjs.com/package/react-moralis#logout