A React hook to fetch ENS records from a domain.

Overview

use-ens

A React hook to fetch ENS records from a domain.

Install

pnpm i use-ens

Example

CodeSandbox

import React, { useEffect } from 'react'
import { useWeb3React } from '@web3-react/core'
import { useENS } from 'use-ens'

const App = () => {
  const { provider, activate } = useWeb3React()

  useEffect(() => {
      injected.isAuthorized().then((isAuth) => {
        if (isAuth) activate(injected)
      })
    }, [])

  const { address, records } = useENS(provider, 'dame.eth')

  return (
    <>
      <p>Address: {address ? address : ''}</p>
      <p>ENS Records</p>
      <ul>
        {records.web && Object.entries(records.web).map(([k, v]) => (
          <li>
            {k}: {v}
          </li>
        ))}
      </ul>
      {!active && <button onClick={() => activate(injected)}>Connect<button>}
    </>
  )
}
You might also like...
Create React App boilerplate template with React, Redux Toolkit, React Router, Ant Design, Axios, Redux-Saga, SASS, Authentication, Routes.

Create React App boilerplate template with React, Redux Toolkit, React Router, Ant Design, Axios, Redux-Saga, SASS, Authentication, Routes. No configuration is required, Start building your App.

React boilerplate that includes Redux, Redux Toolkit, React Router, React-Bootstrap

This project was bootstrapped with Create React App, using the Redux and Redux Toolkit template. Available Scripts In the project directory, you can r

A hapi React Starter kit with react-router, redux, react-transform
A hapi React Starter kit with react-router, redux, react-transform

hapi-react-starter-kit A hapi React Starter kit with react-router, redux, react-transform Light and fast - Don't be sad, be hapi! Inspired by This rep

React + Redux + Firebase + Webpack + React Hot Loader 3 + React Router in one boilerplate

Firebase 3.0 Starter using React Redux This is a Firebase 3.0 start using React and Redux. It uses the latest version of libraries, including the bran

React Native Expo: App Restaurantes realizada con React Hooks, React Native, Firebase
React Native Expo: App Restaurantes realizada con React Hooks, React Native, Firebase

React Native Expo: App Restaurantes realizada con React Hooks, React Native, Firebase Proyecto completo desarrollado con React Native. La app cuenta c

Electron-react-template - Electron React Template uses React Router and Styled Components
Electron-react-template - Electron React Template uses React Router and Styled Components

Electron React Template This template uses Create React App, Electron and Electr

Starwars-episodes-react - Small React application using Context API, axios and React-Bootstrap

Starwars App Small React application using Context API, axios and React-Bootstra

Boilerplate with React client and Express backend written in TypeScript. Offers performance and extended functionality. Comes with SSR and without need to learn a framework. Helps to avoid frequent React-Express integration pitfalls. A toolkit for React, Preact, Inferno & vanilla JS apps, React libraries and other npm modules for the web, with no configuration (until you need it)
A toolkit for React, Preact, Inferno & vanilla JS apps, React libraries and other npm modules for the web, with no configuration (until you need it)

nwb nwb is a toolkit for: Quick Development with React, Inferno, Preact or vanilla JavaScript Developing: React Apps Preact Apps Inferno Apps Vanilla

Owner
v 1 r t l
Tartu University student | 18 yo nullstack dev
v 1 r t l
Universal avatar makes it possible to fetch/generate an avatar based on the information you have about that user.

<Avatar> Universal avatar makes it possible to fetch/generate an avatar based on the information you have about that user. We use a fallback system th

Ambassify 601 Dec 12, 2022
The complete type-safe MUI and react-hook-form combo and beyond with simple API

The complete type-safe MUI and react-hook-form combo and beyond with simple API

Adiat Hasan 45 Dec 24, 2022
A react hook for uploading large files that need chunking.

React Chunked Uploader A react hook for uploading large files that need chunking (for example for uploading to Cloudinary). It uses axios and provides

Raffi Dilanchian 7 Nov 21, 2022
📈 Easily interpolate to a provided value with a simple React hook.

∿ use-smooth-count ∿ Easily interpolate to a provided value with a simple React hook. npm install use-smooth-count or yarn add use-smooth-count Demo E

Conrad Crawford 31 Dec 13, 2022
Electron React Boilerplate uses Electron, React, React Router, Webpack and React Fast Refresh.

Electron React Boilerplate uses Electron, React, React Router, Webpack and React Fast Refresh.

Heikki Lotvonen 2 Oct 6, 2021
A monorepo boilerplate for react web and react native. Uses react-native-web to reduce time invested in making the same components for mobile and web

Monorepo template Get Started Run the following command to install all the dependencies in the right location yarn lerna bootstrap yarn workspace @mar

Amaan Kulshreshtha 5 Dec 12, 2022
React-Typescript-Webpack was config with React, Typescript, and Webpack without CRA. Faster to start your next react project.

Start your react typescript project with manual webpack config in seconds Flexible to control webpack, easy to deploy Keywords: React Starter, Webpack

jdn97 61 Jan 5, 2023
Black Dashboard React is a beautiful Bootstrap 4, Reacstrap and React (create-react-app) Admin Dashboard with a huge number of components built to fit together and look amazing.

Black Dashboard React Black Dashboard React is a beautiful Bootstrap 4, Reacstrap and React (create-react-app) Admin Dashboard with a huge number of c

Creative Tim 403 Dec 25, 2022
Now UI Kit React - Free Bootstrap 4, React, React Hooks and Reactstrap UI Kit

Now UI Kit React is a free Bootstrap 4, React, React Hooks and Reactstrap UI Kit provided for free by Invision and Creative Tim. It is a beautiful cross-platform UI kit featuring over 50 elements and 3 templates.

Creative Tim 132 Dec 19, 2022
Build React Typescript Authentication and Authorization example using React Hooks, React Router, Axios and Bootstrap

React Typescript JWT authentication and authorization example with Hooks, React router, Axios - Role based authentication example

null 38 Dec 19, 2022