npm.io
0.1.8 • Published 4 years ago

use-ens-name

Licence
MIT
Version
0.1.8
Deps
1
Size
9 kB
Vulns
0
Weekly
0
Stars
4

use-ens-name

Simple React hook for displaying ENS names (Ethereum name service).

Instalation

yarn add use-ens-name

Usage

import { useENSName } from 'use-ens-name';

const MyComponent = ({ address }) => {
  const name = useENSName(address)

  return <div>ENS name: {name}</div>
}

The hook will return null when loading, or when no name is found. You can also pass a fallback string:

import { useENSName } from 'use-ens-name';

const MyComponent = ({ address }) => {
  const name = useENSName(address, '(unknown)')

  return <div>ENS name: {name}</div>
}