react.js-web3

1.0.20 • Public • Published

react.js-web3

demo

  • By detecting login and logout of MetaMask, you can develop high DApps of UX.
  • Supports import of contracts

Installation

npm install --save react.js-web3

Usage

Web3Container

import { Web3Container } from 'react.js-web3'
import Examples from '@conponents/Example'

// ...

class Index extends React.Component {

  // ...

  render () {
    return (
      <Web3Container
        renderLoading={() => <div>Loading Accounts Page...</div>}
        render={({ accounts }) => <Examples accounts={accounts} />}
      />
    )
  }
}
  • renderLoading You can specify the View that is displayed when web3.js can not acquire account.
  • render You can pass the account as props to the React Component.

getContract

import { getWeb3, getContract } from "react.js-web3";
import contractDefinition from '@contracts/SimpleStorage.json'

// ...

const web3 = await getWeb3();
const contract = await getContract(web3, contractDefinition)

Readme

Keywords

Package Sidebar

Install

npm i react.js-web3

Weekly Downloads

4

Version

1.0.20

License

ISC

Unpacked Size

12.9 kB

Total Files

16

Last publish

Collaborators

  • toshi1127