score:0

Accepted answer

only thing i see missing is the routes component wrapping the route components. you imported routes but don't appear to have used it. all route components must be rendered into a routes component (or another route if nesting). without the routes you should be seeing the error a <route> is only ever to be used as the child of <routes> element, never rendered directly. please wrap your <route> in a <routes>.

<router>
  <routes>
    <route exact path="/" element={<about />} />
    <route exact path="/shop" element={<shop />} />
  </routes>
</router>

edit react-router-dom-displays-nothing-when-using-route

score:0

check if you have installed react-router-dom version 6. for version 6 you must wrap up all 'route' inside a "routes".


Related Query

More Query from same tag