@parity/light.js-react
TypeScript icon, indicating that this package has built-in type declarations

5.1.19 • Public • Published

@parity/light.js-react

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

Build Status npm (scoped) npm dependencies Status

Usage

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

import light from '@parity/light.js-react';
import { myBalance$, syncStatus$ } from '@parity/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.

/@parity/light.js-react/

    Package Sidebar

    Install

    npm i @parity/light.js-react

    Weekly Downloads

    2

    Version

    5.1.19

    License

    MIT

    Unpacked Size

    18.8 kB

    Total Files

    13

    Last publish

    Collaborators

    • vincecorsica
    • stefan-sopic
    • wirednkod
    • nachopalparity
    • pepo
    • mcornholio
    • dvdplm
    • paritytech-ci
    • parity-jacogr
    • jacogr
    • paritytech
    • kianenigma