https://github.com/crapthings/meteor-data-container
this container let your write less code
https://github.com/crapthings/meteor-data-container
Last synced: about 1 year ago
JSON representation
this container let your write less code
- Host: GitHub
- URL: https://github.com/crapthings/meteor-data-container
- Owner: crapthings
- Created: 2016-10-23T06:04:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-01T07:24:29.000Z (over 9 years ago)
- Last Synced: 2025-01-24T04:52:41.522Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
## Installation
meteor npm i lodash react-komposer --save
meteor add crapthings:meteor-data-container
## Usage
> publish your `posts` and return your posts cursor
```
Meteor.publish('posts', function (userId) {
const selector = userId ? { userId } : {}
return Posts.find(selector)
})
```
> use `MeteorDataContainer` to get your `reactive` data
```
const subscriptions = {
posts: []
}
const data = {
posts () {
return Posts.find().fetch()
{
}
const PostsListComponent = () =>
{posts.map(post) => {post.title}
}
} />
```
> "subscriptions" is an object. each of keys in subscriptions is the subscribe name, and value should be an array that apply as publish args
> "data" is an object, each of keys can be use in container under props