I'm creating a real time chat app with react, react router v4 and redux. The problem is that, as you may know, react router v4 changes a lot of stuff and nesting routes is not working for me.
So I have this code with a nested route that is not working:
<Route path='/' component={App}>
<Route path="/user" component={AddUser}/>
</Route>
It's giving me this error Warning: You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored
.
Where component={App}
, in the first <Route path='/'
is a redux connect:
const App = connect(mapStateToProps, mapDispatchToProps)(Header)
So my component App
has all the the props
I need. All works fine except by the fact that I need to pass those props from App
to the nested route component AddUser
.
How do I pass the redux props
to a separate component in a different Route
?