@susy-js/light.js-react

5.1.3 • Public • Published

@susy-js/light.js-react

A HOC to easily use @susy-js/light.js with React.

Build Status npm (scoped) npm dependencies Status

Usage

The libray provides a higher-order component (HOC) to use @susy-js/light.js's Observables easily with React apps.

import light from '@susy-js/light.js-react';
import { myBalance$, syncStatus$ } from '@susy-js/light.js';

@light({
  myBalance: myBalance$, // myBalance will be a BigNumber
  mySyncVariable: syncStatus$
})
class MyClass extends React.Component {
  render() {
    return (
      <div>
        My balance is {this.props.myBalance.toFormat()}.<br />
        The sync status is {JSON.stringify(this.props.mySyncVariable)}.
      </div>
    );
  }
}

The UI will automatically update when the sync status changes.

Package Sidebar

Install

npm i @susy-js/light.js-react

Weekly Downloads

3

Version

5.1.3

License

MIT

Unpacked Size

9.18 kB

Total Files

8

Last publish

Collaborators

  • superstring