Q1. How do you define routes in React Router v6?
In v6, you use and with element prop. Example: } />} /> . The Routes component ensures only one route matches.
Q2. What is the Link component used for?
Link is used for navigation. It renders an tag but intercepts clicks to prevent full page reload. Example: About. It also provides accessibility features.
Q3. What is the difference between Link and NavLink?
NavLink is a special version of Link that adds styling attributes when it matches the current URL. You can use className or style functions to apply active styles. It's useful for navigation menus.
Q4. How do you handle nested routes?
In v6, nested routes are defined by placing inside a parent element. The parent component should render an where child routes are rendered. Example: }>} /> .
Q5. What is the useNavigate hook?
useNavigate returns a function that lets you navigate programmatically. Example: const navigate = useNavigate(); then navigate('/about') or navigate(-1) to go back.
