Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to pass data to the container (ex: change parameters of the subscription) #155

Open
KyneSilverhide opened this issue Feb 18, 2017 · 1 comment

Comments

@KyneSilverhide
Copy link

KyneSilverhide commented Feb 18, 2017

Hello,

I'm using react-komposer with Meteor. Basically, my code looks like this

const composer = ({ params }, onData) => {
  const runsSub = Meteor.subscribe('runs.view', params._id);
  const teamsSub = Meteor.subscribe('teams.list');

  if (runsSub.ready() && teamsSub.ready()) {
    const run = Runs.findOne();
    const teams = Teams.find().fetch();
    onData(null, { run: run, teams: teams });
  }
};
export default composeWithTracker(composer, Loading)(EditRun);

This works well, but let's say I want to add a third subscription that should update whenever a team (from the team subscription) is selected on screen.

const devSub = Meteor.subscribe('developers.team.list', "THE SELECTED TEAM ID");

What's the best way to achieve this?

@KyneSilverhide KyneSilverhide changed the title Question: How to pass data to the container (ex: chage parameters oft he subscription) Question: How to pass data to the container (ex: change parameters of the subscription) Feb 18, 2017
@avishaan
Copy link

avishaan commented Feb 19, 2017

You need to pass the new 'params' as the prop from the parent component of the container you have shown. I think the Meteor Chef site has some examples of this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants