Skip to content

calebmpeterson/use-remote-storage

Repository files navigation

use-remote-storage

React hook wrapping the remote-storage library.

Installation

This library is published in the NPM registry and can be installed using any compatible package manager.

npm install use-remote-storage --save

# For Yarn, use the command below.
yarn add use-remote-storage

Use

Provide the remote-storage configuration

import { RemoteStorageProvider } from 'use-remote-storage';

<RemoteStorageProvider userId={...} instanceId="my-awesome-app">
  ...
</RemoteStorageProvider>

Read and write values

import { useRemoteStorage } from 'use-remote-storage';

// within any functional component
const { status, value, setValue, refresh } = useRemoteStorage('my-key');

Access the remote-storage instance

import { useRemoteStorageInstance } from 'use-remote-storage';

// within any functional component
const remoteStorage = useRemoteStorageInstance();

Documentation

Documentation generated from source files by Typedoc.

License

Released under MIT License.

About

React hook wrapping the remote-storage library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published