Skip to content

Instantly share code, notes, and snippets.

@nicolaslopezj
Last active August 30, 2016 12:25
Show Gist options
  • Save nicolaslopezj/e06be7edba8b7300274220a02492722d to your computer and use it in GitHub Desktop.
Save nicolaslopezj/e06be7edba8b7300274220a02492722d to your computer and use it in GitHub Desktop.
import {Meteor} from 'meteor/meteor'
import {withData} from 'meteor/orionsoft:react-meteor-data'
import MyCollection from './my-collection'
@withData(({itemId}) => {
const handler = Meteor.subscribe('myPublication', itemId)
const isLoading = !handler.ready()
const item = MyCollection.findOne(itemId)
return {isLoading, item}
})
export default class Component extends React.Component {
render () {
if (this.props.isLoading) return <span/>
return (
<div>
{this.props.item.name}
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment