In this example:
class TodoList extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<Route
path="/todos/new"
component={props => <NewTodoForm {...props} />}
/>
</div>
);
}
}
In the NewTodoForm component, it reaches the {...props}
by using
this.props.history.push("url")
I am confused that in {...props}
, why does it use props
rather than this.props
? I know that is a stateless function and props is a parameter. But where does that props come from?
Any help or comment will be appreciated, thanks.