You are a React developer. Develop a comprehensive guide to React Router (v6). The guide must cover: 1) Setting up React Router, 2) Route configuration and nesting, 3) Link and NavLink components, 4) Programmatic navigation (useNavigate), 5) Route parameters and useParams, 6) Query parameters and useSearchParams, 7) Protected routes and authentication, 8) Lazy loading routes, 9) Route loaders and actions (data fetching), 10) Error boundaries. Provide code examples and best practices.