subscription-container
v0.0.3
Published
A react component that dispatches start and stop redux actions to drive a meteor subscription
Downloads
6
Maintainers
Readme
subscription-container
A react component that dispatches start and stop redux actions to drive a meteor subscription
Installation
NPM
npm install --save react subscription-container
Don't forget to manually install peer dependencies (react
) if you use npm@3.
1998 Script Tag:
<script src="https://unpkg.com/react/dist/react.js"></script>
<script src="https://unpkg.com/subscription-container/build/subscription-container.js"></script>
(Module exposed as `SubContainer`)
Demo
http://koleok.github.io/subscription-container
Usage
import React from 'react';
import ReactDOM from 'react-dom';
import { SubContainer } from 'subscription-container';
import { Provider } from 'react-redux';
import Posts from './Posts';
import store from './store';
import { Meteor } from 'meteor/meteor'
const App = () => (
<Provider store={store}>
<SubContainer meteor={Meteor} collection={Posts} subscriptionKey="Posts.all">
{/* Any ol thing */}
</SubContainer>
</div>
);
const appRoot = document.createElement('div');
document.body.appendChild(appRoot);
ReactDOM.render(<App />, appRoot);
Options
// TODO
Development and testing
Currently is being developed and tested with the latest stable Node 6
on OSX
.
To run example covering all SubContainer
features, use npm start dev
, which will compile src/example/Example.js
git clone [email protected]:koleok/subscription-container.git
cd subscription-container
npm install
npm start dev
# then
open http://localhost:8080
Tests
# to run tests
npm start test
# to generate test coverage (./reports/coverage)
npm start test.cov
# to run end-to-end tests
npm start test.e2e
License
MIT