useNavigate Quiz

Test your knowledge of the useNavigate hook in React Router.

20 questions · free · answers explained

Start the quiz

All questions in this quiz

  1. Which React Router hook is used for programmatic navigation in React Router v6?
  2. What does the useNavigate hook return?
  3. How do you navigate to the dashboard route with useNavigate?
  4. Which option replaces the current history entry instead of pushing a new one?
  5. How can you navigate back one entry in the browser history with useNavigate?
  6. How can you navigate forward one entry in the browser history with useNavigate?
  7. Where should useNavigate be called?
  8. Which example passes route state while navigating?
  9. Which hook is commonly used to read state passed by useNavigate?
  10. What is the main difference between Link and useNavigate?
  11. When is useNavigate a good fit?
  12. Which React Router v5 hook did useNavigate largely replace?
  13. Which call is closest to the old history.replace('/profile') pattern?
  14. What happens if navigate is called with a relative path like navigate('settings') from a nested route?
  15. How do you navigate to a parent route from a nested route?
  16. Which option should you use if a post-login redirect should not let users go back to the login page?
  17. Can useNavigate be used outside a Router provider?
  18. Which is the best way to navigate after an async save completes?
  19. Which statement about useNavigate is accurate?
  20. Which snippet correctly initializes the navigate function?

Prefer to read first? React interview questions with written answers.