Question · JavaScript and React course · Module 6: React Router

Error handling in routing

How do you handle non-existent paths (404) in React Router v6?

Answer options

  • Using try/catch in the component
  • React Router automatically handles 404
  • Using an Error Boundary
  • By defining a Route with path='*' as the last one

You can check the correct answer by solving this task in the CodeWorlds game.