1.2.5 • Published 6 years ago

@pomelyu/react-meteor-client v1.2.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-meteor-client

Served as client-side package for meteor subscription and method caller

This repository is forked from inProgress-team/react-native-meteor, and modified according to ZevenFang/react-meteor

Usage

import Metor, { creatContainer } from 'react-meteor-client';
import App from './App';

const mapMeteorDataToProps = () => {
  Meteor.subscribe('tasks');
  return {
    tasks: Meteor.collection('tasks').find({}) || [],
    incompleteCount: Meteor.collection('tasks').find({ checked: { $ne: true } }).length,
    currentUser: Meteor.user() || null,
  };
};

export default createContainer(mapMeteorDataToProps, App);

Example

# Build this package
npm install
npm run build

# Publish (After build)
cd dist
npm publish

# Meteor server side (official todos example)
cd example/MeteorApp
meteor npm install
meteor npm start # meteor run at localhost:3333

# React client side
cd example ReactApp
npm install
npm start # react-app run at localhost:3000