Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmihal/use-ens-name
https://github.com/dmihal/use-ens-name
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dmihal/use-ens-name
- Owner: dmihal
- Created: 2021-12-20T18:08:45.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-15T15:49:56.000Z (almost 3 years ago)
- Last Synced: 2024-10-04T10:40:30.195Z (about 1 month ago)
- Language: TypeScript
- Size: 5.86 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# use-ens-name
Simple React hook for displaying ENS names (Ethereum name service).
## Instalation
```
yarn add use-ens-name
```## Usage
```jsx
import { useENSName } from 'use-ens-name';const MyComponent = ({ address }) => {
const name = useENSName(address)return
ENS name: {name}
}
```The hook will return `null` when loading, or when no name is found. You can also pass a fallback string:
```jsx
import { useENSName } from 'use-ens-name';const MyComponent = ({ address }) => {
const name = useENSName(address, '(unknown)')return
ENS name: {name}
}
```