rangeme rangeme - 7 months ago 80
Javascript Question

How can I pass variables to function from onClick in Meteor/React?

I have some code like so

goToEvent() {

return (
{e.users.map( (id) => {
<ListItem key={id} primaryText="Event" onClick={this.goToEvent.bind(this)} />

I'm unsure how to get the id parameter into the

I actually have the bind in the constructor so I tried having
but realized that was incorrect because it was calling the method immediately.

Any help or direction would be appreciated.


For react the solution is

return ( {e.users.map( (id) => { <ListItem key={id} primaryText="Event" onClick={this.goToEvent.bind(this, id)} /> })} );