# react-connex

> Higher-order component (HOC) providing Connex context to React app

Latest version **0.8.1** (published 2019-02-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-connex
pnpm add react-connex
yarn add react-connex
bun add react-connex
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.1 |
| Published | 2019-02-15 |
| First published | 2019-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kenneth Ashley |
| Maintainers | kennethashley |
| Keywords | vechain, comet, vechain sync, connex, vechain thor, provider |

## Links

- npm: https://www.npmjs.com/package/react-connex
- Homepage: https://github.com/KennethAshley/react-connex#readme
- Issues: https://github.com/KennethAshley/react-connex/issues
- npm.io page: https://npm.io/package/react-connex

## Dependencies (2)

- [web3-utils](https://npm.io/package/web3-utils.md) ^1.0.0-beta.46
- [hoist-non-react-statics](https://npm.io/package/hoist-non-react-statics.md) ^3.3.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.8.1 (latest) — 2019-02-15
- 0.8.0 — 2019-02-15
- 0.7.0 — 2019-02-15
- 0.5.0 — 2019-02-15
- 0.4.0 — 2019-02-15
- 0.3.0 — 2019-02-15
- 0.2.0 — 2019-02-15
- 0.1.0 — 2019-02-15

## README

# react-connex

Simple higher-order component (HOC) providing a Connex context to React app.

Detects whether the user is using Sync or a Comet wallet-enabled browser.

## Installation
```sh
$ yarn add react-connex
```

## Basic Usage
Add the `ConnexProvider to your root React Component;
```js
import ConnexProvider from 'react-connex';

<ConnexProvider
  loading="Loading..."
  error={err => `Connection error: ${err}`}>
  <App />
</ConnexProvider>
```

Then in the component where you want to use Connex:
```js
import { withConnex } from 'react-connex';

class MyComponent {
  render() {
    const { connex } = this.props;
    const status = connex.thor.status;

    return status.progress;
  }
}

export default withConnex(MyComponent);
```

You can use the injected `getNetwork` property to get network details:
```js
import { withConnex } from 'react-connex';

class MyComponent {
  render() {
    const { getNetwork } = this.props;
    getNetwork().then(network => {
      return `${network.id} and ${network.name}`
    });
  }
}

export default withConnex(MyComponent);
```

---
_Source: https://npm.io/package/react-connex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
