# @nyby/meteor-react-js

> Full Meteor Client for React JS

Latest version **1.4.2** (published 2024-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nyby/meteor-react-js
pnpm add @nyby/meteor-react-js
yarn add @nyby/meteor-react-js
bun add @nyby/meteor-react-js
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.2 |
| Published | 2024-03-12 |
| First published | 2022-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 96.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | jkthinksmart, weizhuo, dev_nyby |
| Keywords | react-component, ddp, meteor, react |

## Links

- npm: https://www.npmjs.com/package/@nyby/meteor-react-js
- Repository: https://github.com/nyby/meteor-react-js
- Homepage: https://github.com/nyby/meteor-react-js.git
- Issues: https://github.com/nyby/meteor-react-js/issues
- npm.io page: https://npm.io/package/@nyby/meteor-react-js

## Dependencies (10)

- [ejson](https://npm.io/package/ejson.md) ^2.2.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [base-64](https://npm.io/package/base-64.md) ^1.0.0
- [process](https://npm.io/package/process.md) ^0.11.10
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.2.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.8.1
- [set-immediate-shim](https://npm.io/package/set-immediate-shim.md) ^2.0.0
- [@meteorrn/minimongo](https://npm.io/package/@meteorrn/minimongo.md) ^1.0.1
- [wolfy87-eventemitter](https://npm.io/package/wolfy87-eventemitter.md) ^5.2.9
- [node-require-fallback](https://npm.io/package/node-require-fallback.md) ^1.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.4.2 (latest) — 2024-03-12
- 1.4.1 — 2023-11-24
- 1.4.0 — 2023-11-24
- 1.3.2 — 2023-04-20
- 1.3.1 — 2023-04-18
- 1.3.0 — 2023-04-18
- 1.2.3 — 2023-03-31
- 1.2.2 — 2023-03-31
- 1.2.1 — 2022-06-29
- 1.2.0 — 2022-06-27
- 1.1.29 — 2022-06-23
- 1.1.28 — 2022-05-14
- 1.1.27 — 2022-05-14

## README

# Meteor React JS

This package is based on the `@meteorrn/core` package for React Native. 
Some little adjustments to make it work in the browser. All credits for the 
awesome work should go to the maintainers of the original package for React Native. 
Feel free to comment, contribute and fix. A hook version 
called `Meteor.useTracker` is also available.

A set of packages allowing you to connect your React app to your Meteor server, 
and take advantage of Meteor-specific features like accounts, reactive data 
trackers, etc. Compatible with the latest version of React.

[Full API Documentation](/docs/api.md)

## Installation

~~~
npm install --save @nyby/meteor-react-js
~~~

## Basic Usage

```javascript
import Meteor from '@nyby/meteor-react-js';

// "mycol" should match the name of the collection on your meteor server
let MyCol = new Meteor.Mongo.Collection('mycol');

// Note the /websocket after your URL
Meteor.connect('wss://myapp.meteor.com/websocket'); 

class App extends React.Component {
  render() {
    let { myThing } = this.props;

    return (
      <div>
        <span>Here is the thing: {myThing.name}</span>
      </div>
    );
  }
}

let AppContainer = Meteor.withTracker(() => {
  Meteor.subscribe('myThing');
  let myThing = MyCol.findOne();

  return {
    myThing,
  };
})(App);

export default AppContainer;
```

## Custom hooks

There are also custom hooks for managing subscriptions and calling Meteor methods implemented.

### Meteor.usePublication

```javascript
const [data, loading] = Meteor.usePublication({
  name: 'publication.name',
  params: { id: _id },
  fetch: () => MyCol.findOne({ _id: id }),
});
```

### Meteor.useMethod

```javascript
const { result, loading } = Meteor.useMethod('method.name', { id: _id });
```

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