1.0.0 • Published 4 years ago

react-ipfs-hook v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

react-ipfs-hook

Connect to an external IPFS daemon. The embedded node is too limited to be usable so an external node is a must.

Author

onichandame

Usage

To install: yarn add @onichandame/react-ipfs-hook

For live example check https://onichandame.com/react-ipfs-hook/

For detailed usage see the example.

// App.tsx
import { IpfsProvider } from '@onichandame/react-ipfs-hook'
const App = () => {
  return (
    <IpfsProvider>
      <Child />
    </IpfsProvider>
  )
}

// child.tsx
import { useIpfs } from '@onichandame/react-ipfs-hook'
const Child: FC = () => {
  const ipfsPromise = useIpfs()
  const [id, setId] = useState(``)
  useEffect(() => {
    ipfsPromise.then((ipfs) => ipfs.id().then((id) => setId(id.id)))
  }, [ipfsPromise])
  return <div>{id}</div>
}
1.0.0

4 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.0

5 years ago