Prop from flow router to component with React

HI
I readed this guide: https://guide.meteor.com/react.html
const App = (props) => (
  <div>
    <section id="menu"><..></section>
    {props.main}
  </div>
);
export default AppContainer = createContainer(props => {
  // props here will have `main`, passed from the router
  // anything we return from this function will be *added* to it
  return {
    user: Meteor.user(),
  };
}, App);

import React from 'react';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { mount } from 'react-mounter';
import AppContainer from '../../ui/containers/AppContainer.js';
import ListPageContainer from '../../ui/containers/ListPageContainer.js';
FlowRouter.route('/lists/:_id', {
  name: 'Lists.show',
  action() {
    mount(AppContainer, {
      main: <ListPageContainer/>,
    });
  },
});

The question is. HOW i can obtain the “user” variable in my ListPageContainer. I tried several times with no result. I want to obtain an update of the Meteor.user.

Thanks :slight_smile:

Even though this topic is old, I’d like to help those who are searching for this solution as I was stuck too.

The way you pass data to the child components is through using a function, like this:

const App = (props) => (
  <div>
    <section id="menu"><..></section>
    {props.main(props)} // pass the props here
  </div>
);

and then change:

FlowRouter.route('/lists/:_id', {
  name: 'Lists.show',
  action() {
    mount(AppContainer, {
      main: (props) => (<ListPageContainer user={props.user} />),
    });
  },
});

Then you should be able to access the parent ‘user’ data by using ‘this.props.user’ or accessing ‘props.user’ after passing props as the argument for a stateless component.