Comparing version 0.0.0-wip.10 to 0.0.0-wip.11
{ | ||
"name": "use-ens", | ||
"version": "0.0.0-wip.10", | ||
"version": "0.0.0-wip.11", | ||
"description": "A React hook to fetch ENS data", | ||
@@ -25,3 +25,3 @@ "files": [ | ||
"dependencies": { | ||
"get-ens": "^0.1.5" | ||
"get-ens": "^1.0.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "peerDependencies": { |
@@ -11,6 +11,8 @@ # use-ens | ||
## Usage | ||
## Example | ||
[![CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/useens-demo-q566k) | ||
```jsx | ||
import React from 'react' | ||
import React, { useEffect } from 'react' | ||
import { useWeb3React } from '@web3-react/core' | ||
@@ -20,6 +22,12 @@ import { useENS } from 'use-ens' | ||
const App = () => { | ||
const { provider } = useWeb3React() | ||
const { provider, activate } = useWeb3React() | ||
const { address, records, owner } = useENS(provider)('dame.eth') | ||
useEffect(() => { | ||
injected.isAuthorized().then((isAuth) => { | ||
if (isAuth) activate(injected) | ||
}) | ||
}, []) | ||
const { address, records } = useENS(provider, 'dame.eth') | ||
return ( | ||
@@ -30,3 +38,3 @@ <> | ||
<ul> | ||
{Object.entries(records).map(([k, v]) => ( | ||
{records.web && Object.entries(records.web).map(([k, v]) => ( | ||
<li> | ||
@@ -37,2 +45,3 @@ {k}: {v} | ||
</ul> | ||
{!active && <button onClick={() => activate(injected)}>Connect<button>} | ||
</> | ||
@@ -39,0 +48,0 @@ ) |
2121
47
+ Addedget-ens@1.0.2(transitive)
- Removedget-ens@0.1.6(transitive)
Updatedget-ens@^1.0.0