UNPKG

@parity/light.js

Version:

A high-level reactive JS library optimized for light clients

35 lines (28 loc) 717 B
// Copyright 2015-2019 Parity Technologies (UK) Ltd. // This file is part of Parity. // // SPDX-License-Identifier: MIT import React, { Component } from 'react'; import { peerCount$ } from '@parity/light.js'; import light from '@parity/light.js-react'; // NOTE: with the right Babel configuration (or TypeScript), // you can use use `light` as a decorator: // @light({ // peerCount: peerCount$ // }) class PeerCount extends Component { render() { const { peerCount } = this.props; return ( <div> <h2>peerCount$</h2> <h3>Current peer count</h3> {+peerCount} </div> ); } } PeerCount = light({ peerCount: peerCount$ })(PeerCount); export default PeerCount;