I’m currently having issues implementing loaders on my local machine. I tried to replicate the protected routes from the react router course. I keep getting an error
import {
createBrowserRouter,
RouterProvider,
createRoutesFromElements,
Route
} from "react-router-dom"
import Layout from "./components/Layout"
import Home from "./pages/Home"
import HostLayout from "./pages/HostLayout"
import Dashboard from "./pages/Host/Dashboard"
import Income from "./pages/Host/Income"
import {
default as HostVans, loader as hostVansLoader
} from "./pages/Host/Vans"
import HostVanInfo, { loader as hostVanInfoLoader } from "./pages/Host/HostVanInfo"
import Reviews from "./pages/Host/Reviews"
import About from "./pages/About"
import Vans, { loader as vansLoader } from "./pages/Vans"
import VanDetails, { loader as vanDetailsLoader } from "./pages/VanDetails"
import Details from "./pages/Host/Details"
import Pricing from "./pages/Host/Pricing"
import Photos from "./pages/Host/Photos"
import NotFound from "./pages/NotFound"
import Error from "./components/Error"
import Login from "./components/Login"
import "./server"
import { requireAuth } from "./utils"
const router = createBrowserRouter(
createRoutesFromElements(
<Route element={<Layout />}>
<Route path="*" element={<NotFound />} />
<Route index element={<Home />} />
<Route path="host" element={<HostLayout />}>
<Route
index
element={<Dashboard />}
/>
<Route
path="income"
element={<Income />}
loader={async ()=> await requireAuth()}
/>
<Route
path="vans"
element={<HostVans />}
loader={hostVansLoader}
/>
<Route
path="vans/:id"
element={<HostVanInfo />}
loader={hostVanInfoLoader}
>
<Route index element={<Details />} />
<Route path="pricing" element={<Pricing />} />
<Route path="photos" element={<Photos />} />
</Route>
<Route path="reviews" element={<Reviews />} />
</Route>
<Route path="about" element={<About />} />
<Route path="vans"
loader={vansLoader}
element={<Vans />}
errorElement={<Error />}
/>
<Route
path="vans/:id"
element={<VanDetails />}
loader={vanDetailsLoader}
/>
<Route path="login" element={<Login />} />
</Route>
)
)
export default function App() {
return (
<RouterProvider router={router} />
)
}