Answer the question
In order to leave comments, you need to log in
How to pass props to React-router?
Hey!
<Route
component={() => logged ? <Product /> : <Redirect to='/' />}
exact
path='/products/:id'
/>
<Route
component={Product}
exact
path='/products/:id'
/>
Answer the question
In order to leave comments, you need to log in
Good day! The Route
component has a render parameter .
<Route
render = { props => logged ? <Product /> : <Redirect to='/' /> }
exact
path='/products/:id'
/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question