Why my LINK component does not render the component that match the URL? , it only changes the url on the browser

Viewed 40

Imports and PageNotFound component: Imports and PageNotFound component

App main component:

App main component

2 Answers

You didn't include path prop to the route where you render PageNotFound.

Change

<Route>
  <PageNotFound/>
</Route>

to

<Route path="*">
  <PageNotFound/>
</Route>

There is currently an incompatibility between react-router-dom@5 and React 18

Related