0.5.8 • Published 7 years ago

react-redux-meteor-data v0.5.8

Weekly downloads
9
License
ISC
Repository
github
Last release
7 years ago

#Description

This package provides an integration between React, Redux store and Meteor's Tracker.

It's simple composition of "connect" function from "react-redux" package and "createContainer" from "react-meteor-data".

Redux connector HOC applies first, then props pass down to meteor HOC.

#Using

Signature:

connectMeteor(mapTrackerToProps, mapStateToProps, mapDispatchToProps)(Component)

#Example

MyComponent will receive currentId and item props:

import connectMeteor from 'react-redux-meteor-data';
import MyCollection from '/imports/collections/MyCollection.js';
import MyComponent from '/imports/components/MyComponent.jsx';
import * as actions from '/imports/redux/actions.js';

const mapStateToProps = (state, ownProps) => {
  let currentId = state.selectedId;
  return {
    currentId
  };
}

const mapTrackerToProps = (props) => {
    let sub = Meteor.subscribe('process');
    let item = MyCollection.findOne({_id:  props.currentId})

  return {
    item
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    actions: bindActionCreators(actions, dispatch)
  }
}


export default connectMeteor(mapTrackerToProps, mapStateToProps, mapDispatchToProps)(MyComponent);

#Contribution

Please open issue on github.

0.5.8

7 years ago

0.5.7

7 years ago

0.5.6

7 years ago

0.5.5

7 years ago

0.5.4

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago