meteor-standalone-react-mixin

0.0.56 • Public • Published

ReactMeteorData

This is a standalone version meant for use OUTSIDE of Meteor projects. It has been minimally modified for installation with NPM and framework-agnostic use.

Check out the Todo to see how it works

This mixin is a convenient way to use data from a Meteor reactive data source in a React component, with automatic updates when the data changes.

getMeteorData is a reactive context. Whatever is returned is available on the React object's .data property.

More complete docs available at the example Todo repo

Quick Example:

import { Mongo, ReactMeteorData } from 'meteor-standalone-react-mixin'

var Todos = new Mongo.Collection('todos');

TodoApp = React.createClass({
  mixins: [ReactMeteorData],
  getMeteorData() {
    // Reactive context
    // do all your reactive data access in this method.
    return {
      todos: Todos.find().fetch(),
    };
    // /Reactive context
  },
  render() {
    return <div>
      <span>{this.data.todos.map(<TodoItem todo={todo}/>)}</span>
    </div>;
  }
});

Full example in the Todo Sample Application

Meteor docs.

API

This package exposes:

  • Mongo.Collection
  • Minimongo
  • ReactiveDict
  • ReactiveVar
  • Tracker
  • EJSON
  • ... and more!

Readme

Keywords

none

Package Sidebar

Install

npm i meteor-standalone-react-mixin

Weekly Downloads

6

Version

0.0.56

License

MIT

Last publish

Collaborators

  • ivanthedeployer