tripledoc-react

React utilities to interface with a Solid Pod using Tripledoc

Usage no npm install needed!

<script type="module">
  import tripledocReact from 'https://cdn.skypack.dev/tripledoc-react';
</script>

README

tripledoc-react

Utilities to make it easier to work with Tripledoc in React applications.

Installation

npm install tripledoc-react plandoc solid-auth-client

Usage

import { describeDocument, fetchDocument } from 'plandoc';
import { useDocument } from 'tripledoc-react';

const virtualProfileDoc = describeDocument().isFoundAt('https://www.w3.org/People/Berners-Lee/card');

const SomeComponent = () => {
  const [profileDoc, setProfileDoc] = useDocument(virtualProfileDoc);

  if (typeof profileDoc === 'undefined') {
    return <>Loading…</>;
  }
  if (profileDoc === null) {
    return <>Error: Could not fetch profile information.</>
  }

  // Do something with `profileDoc`
};

Changelog

See CHANGELOG.

License

MIT © Inrupt