Switch in react router dom is not working!
problem seems to arrive when rendering the AddTodo and Todos element!
Tried replacing the switch with route but it still does not reem to render anything
return (
<>
<Router>
<Header title="Task" />
<Routes>
<Route exact path="/" render={() => {
return (
<>
<AddTodo addTodo={addTodo} />
<Todos todos={todos} onDelete={onDelete} />
</>
)
}} >
</Route>
<Route exact path="/about" element={<About />}></Route>
</Routes>
<Footer />
</Router>
</>
);
2
Answers
Worked for me when i did this !
);
use BrowserRouter for last version (v6)