Answer the question
In order to leave comments, you need to log in
Why are props not being passed through the router?
Good afternoon. I'm just starting to learn react and got into an unpleasant situation.
Task: to pass props through the component hierarchy from top to bottom. Everything is transferred between neighboring components, but since the course is a bit outdated and react is changing fast, I can't do what is done in the course.
I am rendering an object in index.js and trying to pass it through props.
ReactDOM.render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>,
document.getElementById('root')
);
<>
<Routes>
<Route path="/" element={<Layout />}>
<Route index element={<Home/>} />
<Route path="/cases" element={<Cases />} />
<Route path="/works-all" element={<WorksAll />} />
<Route path="*" element={<NotFoundPage />} />
</Route>
</Routes>
</>
<div className={app.container}>
<div className={app.page}>
<div className={app.info}>
<Card />
<About />
</div>
<div className={app.content}>
<Greeting />
<Outlet />
</div>
</div>
</div>
<div className={`${app.block} ${cases.cases}`}>
<div className={app.title}>
<h2 className={app.header}>
Cases
</h2>
<NavLink className={ `${app.more} ${cases.more}` } to="/cases">
View all cases
</NavLink>
</div>
<ul className={cases.list}>
<Case />
</ul>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question