I am trying to make a table row function like a Link
with react-router
.
I keep getting the error Cannot read property 'handleClick' of undefined
handleClick(user) {
this.router.transitionTo('index', user);
}
render(){
var userNodes = this.props.posts.map(function(user, i){
return (
<tr onClick={() => this.handleClick(user)}>
<Td>{user.postId}</Td>
<Td>{user.title}</Td>
<Td>{user.body}</Td>
</tr>
)
});
...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…