Answer the question
In order to leave comments, you need to log in
How to correctly pass props to route which is located above?
Can you please tell me how to pass props to the component above?
The tree is an
App component, 2 more components are rendered in it
const App = () => {
return (
<div>
<Switch>
<Route exact path='/' render={() => <Main />} />
<Route path='/list' render={() => <List />} />
</Switch>
</div>
);
}
<Music />
, so this Music component receives props from Main and renders another component <Track />
that is wrapped in<Link to='/list'>
<Track ...разные пропсы и отрисовка/>
<Link />
Answer the question
In order to leave comments, you need to log in
Options:
1. Rise of the state.
2. Using a state management library like redux.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question