react-ipfs-provider

1.0.6 • Public • Published

react-ipfs-provider

npm package

IPFS Context Provider for React, all the fun of IPFS with as little prop drilling and double locking repo's as possible

Install

With NPM

npm i --save react-ipfs-provider

With Yarn

yarn add react-ipfs-provider

Usage

App.js

import React from 'react';
import Component from './component';
import { Provider } from 'react-ipfs-provider';
 
export default function App(props){
  return (
    <Provider ipfs={/* optional ipfs node prop */}>
      <div>
        <Component />
      </div>
    </Provider>
  );
}
 

Component.js

import React from 'react';
 
import { withIPFS } from 'react-ipfs-provider';
 
function Component(props){
  
  React.useEffect(() => {
    props.ipfs.add('Content to IPFS')
  }, [])
  
  return (
    <div>
      {props.ipfs.provider.id} 
    </div>
  );
}
 
export default withIPFS(Component)

Readme

Keywords

Package Sidebar

Install

npm i react-ipfs-provider

Homepage

http:

Weekly Downloads

0

Version

1.0.6

License

MIT

Unpacked Size

23.2 kB

Total Files

15

Last publish

Collaborators

  • thetechcompany