I have the following Route
which renders when the path is matched:
<Route exact path="/create-team" render={() => <TeamNameCard/>}/>
This properly renders the <TeamNameCard/>
component, however the match
, location
, and history
props are not available in this.props
.
However, when rendering the component using the following, those props are available:
<Route exact path="/create-team" component={TeamNameCard}/>
According to the documentation, all render methods should receive these same props. Why is this not working as expected?
EDIT: I've noticed that the following syntax seems to give me access to the needed route props:
render={(props) => <TeamNameCard {...props} />
I've yet to see this before. Is this correct, or is there a better way?