How to use the web3-react.useWeb3Context function in web3-react

To help you get started, we’ve selected a few web3-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bugduino / idle / client / src / Web3ConnectionButtons / Web3ConnectionButtons.js View on Github external
export default function Web3ConnectionButtons(props) {
  const context = useWeb3Context()
  const size = props.size || 'large';

  if (!context.active && !context.error) {
    console.log('context loading', context);
  } else if (context.error) {
    console.log('context error', context);
  } else {
    console.log('context success', context);
  }
  const setConnector = async connectorName => {
    if (localStorage && connectorName === 'Injected') {
      localStorage.setItem('walletProvider', 'Injected');
    }
    return await context.setConnector(connectorName);
  };
  const unsetConnector = async () => {

web3-react

A simple, powerful framework for building modern Ethereum dApps using React.

GPL-3.0
Latest version published 5 years ago

Package Health Score

45 / 100
Full package analysis

Popular web3-react functions