I have a problem, I'm passing (IMO) in the props the right way, but I still have that error:
I have these lines of code in my App.js
This one is working:
<Route path="/users/:username"
render={(props) => <Profile isAuthenticated={this.state.isAuthenticated} currentUser={this.state.currentUser} {...props} />}>
</Route>
But this one is not working, while rendering "Ride" I am getting an error
<Route path="/ride/:username"
render={(props) => <Ride isAuthenticated={this.state.isAuthenticated} currentUser={this.state.currentUser} {...props} />}>
</Route>
Error: TypeError: Cannot read property 'params' of undefined
43 | }
44 |
45 | componentDidMount() {
> 46 | const username = this.props.match.params.username;
47 | ^ this.loadUserProfile(username);
48 | }
49 |
Even when the code is inside (components) they are the same...