Setting Up and Configuring TanStack Router

Demonstrate initializing TanStack Router in a JavaScript application, defining basic routes, and rendering those routes.
import { createBrowserRouter, RouterProvider } from '@tanstack/react-router';
import Home from './Home';
import About from './About';
import Contact from './Contact';
Imports necessary components from TanStack Router and the component pages.
const router = createBrowserRouter([
  { path: '/', element: <Home /> },
  { path: '/about', element: <About /> },
  { path: '/contact', element: <Contact /> }
Defines routes for the application using createBrowserRouter, mapping paths to components.
function App() {
  return <RouterProvider router={router} />;
Creates a functional component that uses RouterProvider to enable routing in the application.