react router and routes is not working , i could not able to navigate to blogs page
In react-router-dom
v6 the Route
component API changed significantly. It no longer takes component
or render
or children
function props, all replaced by a single element
prop that takes a ReactElement
(a.k.a. JSX).
Routes and Route
declare function Route( props: RouteProps ): React.ReactElement | null; interface RouteProps { caseSensitive?: boolean; children?: React.ReactNode; element?: React.ReactElement | null; index?: boolean; path?: string; }
Swap from component
to element
prop and pass the routed component as JSX.
<Routes>
<Route path='blogs' element={<Blogs />} />
<Route path='/' element={<App />} />
</Routes>