0.0.56 • Published 8 years ago
meteor-standalone-react-mixin v0.0.56
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
API
This package exposes:
- Mongo.Collection
- Minimongo
- ReactiveDict
- ReactiveVar
- Tracker
- EJSON
- ... and more!