Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/revolunet/react-orbitdb
react hooks and providers for dealing with ipfs orbit-db datasources
https://github.com/revolunet/react-orbitdb
decentralized ipfs orbitdb react react-hooks
Last synced: 3 months ago
JSON representation
react hooks and providers for dealing with ipfs orbit-db datasources
- Host: GitHub
- URL: https://github.com/revolunet/react-orbitdb
- Owner: revolunet
- Created: 2020-06-09T12:10:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-08T01:33:01.000Z (almost 2 years ago)
- Last Synced: 2023-03-10T19:32:27.725Z (almost 2 years ago)
- Topics: decentralized, ipfs, orbitdb, react, react-hooks
- Language: JavaScript
- Homepage: https://revolunet.github.io/react-orbitdb
- Size: 4.03 MB
- Stars: 21
- Watchers: 2
- Forks: 6
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-orbitdb
[![](https://img.shields.io/badge/License-Apache--2.0-yellow.svg)](https://opensource.org/licenses/Apache-2.0)
[![](https://img.shields.io/npm/v/react-orbitdb.svg)](https://www.npmjs.com/package/react-orbitdb)react hooks and providers for dealing with [IPFS](https://ipfs.io) [orbit-db datasources](https://github.com/orbitdb/orbit-db).
You can see a demo here : https://revolunet.github.io/react-orbitdb
## Provider
`OrbitProvider` creates a shared IPFS Node and an orbit-db instance.
```js
import { OrbitProvider } from "react-orbitdb";const App = () => ...;
```- `config` prop with [ipfs configuration](https://github.com/ipfs/js-ipfs/blob/master/docs/CONFIG.md) can be passed to the provider. (see the [default](./src/ipfs-config.js))
## Hooks
#### useOrbitDb
`useOrbitDb` connects and return records from an OrbitDB database. `records` are updated in real-time.
```jsx
import { useOrbitDb } from "react-orbitdb";const MyCmp = () => {
const { db, records } = useOrbitDb("/orbitdb/somehash/my-db, {
create: true,
type: 'eventlog'
});return (
{records &&
records.map((record) =>{record.message})}
);
};
```- `options` : [OrbitDB.open options](https://github.com/orbitdb/orbit-db/blob/master/API.md#orbitdbopenaddress-options)
- the `options.create` and `options.public` values set the database world-writeable when you first create it.#### useOrbit
`useOrbit` is included in `OrbitProvider`, you should not need it
#### useIpfs
`useIpfs` is included in `OrbitProvider`, you should not need it