I have been learning routing in react recently and this is the problem i am facing when i tried to use the object style routing rather than jsx style routing
error: SyntaxError: Unexpected token ‘<‘
Note : i have tried chat gpt and it is saying network error in fetching an api details but it is not that problem as the code is running in jsx style
import React from "react";
import { createBrowserRouter } from "react-router-dom";
import Layout from "./Layout";
import { About, Contact, Github, Home } from "./components";
import { getGithubData } from "./components/Github/Github";
const router = createBrowserRouter(
[
{
path: "/",
element: <Layout/>,
children: [
{
path: "/",
element: <Home/>,
index: true
},
{
path: "contact",
element: <Contact/>
},
{
path: "about",
element: <About/>
},
{
path: "github",
element: <Github/>,
loader : getGithubData
},
]
}
]
)
export default router
this is my router file
I tried chat gpt I used the network monitoring for any network request failure but nothing seem to work
Shuvo Saha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.