Q1. What are nested routes in React Router?
Nested routes allow you to render child components within a parent component based on the URL. They help create layouts where a common UI (like a sidebar) persists while the nested content changes.
Q2. How do you define nested routes in v6?
Define a parent Route with an element, and place child Route components inside it. The parent component must include an where the child routes will be rendered. Example: }>} /> .
Q3. What is the Outlet component?
Outlet is a component that acts as a placeholder for rendering child routes. When a nested route matches, its element is rendered where the Outlet is placed in the parent component.
Q4. How do you link to nested routes?
Use relative paths in Link. For example, if you're in /dashboard, a Link to "settings" will go to /dashboard/settings. You can also use absolute paths.
Q5. Can you nest routes deeply?
Yes, you can nest routes arbitrarily deep. Each level needs its own Outlet. This is useful for complex layouts like multi-level navigation.
