Meteor / React / Flow Router / Passing parameters to JSX

414 views Asked by At

Simple question here: In Meteor with React how do I pass a parameter to .jsx . I want to send the :token param to my jsx so I can use it after the form submit.

I'm using kadira's flow-router and react-layout packages

Route

FlowRouter.route('/reset/:token',{
  name: 'reset',
  action: function(params){
    ReactLayout.render(App, {
      content: <Reset token={params.token} />
    })
  }
})

Reset.jsx

Reset = React.createClass({
    resetPass(e){
        e.preventDefault();
        alert("test");
    },
    render() {
      return (
             <form onSubmit={this.resetPass}>
                 <input type="password" id="password"/>
                 <input type="password" id="confirmation"/><br /><br />
                 <input type="submit" id="reset-button" value="Reset password" />
            </form>
      );
    }
})
1

There are 1 answers

0
Alain Goldman On BEST ANSWER

Solved

I can get the info with this.props.token

Reset = React.createClass({
    resetPass(e){
        e.preventDefault();
        alert(this.props.token);
    },
    render() {
      return (
             <form onSubmit={this.resetPass}>
                 <input type="password" id="password"/>
                 <input type="password" id="confirmation"/><br /><br />
                 <input type="submit" id="reset-button" value="Reset password" />
            </form>
      );
    }
})