My Code –
import React from "react";
import ReactDOM from "react-dom/client";
import "../App.css"
import About from "./About"
import App from "../App";
import {
createBrowserRouter ,
RouterProvider
} from "react-router-dom";
const router = createBrowserRouter([
{
path: "/",
element:<App/>,
},
{
path:"/about",
element:<About/>,
}
])
ReactDOM.createRoot(document.getElementById('root')).render(
<RouterProvider route = {router}/>
)
Error –
Uncaught TypeError: Cannot read properties of undefined (reading ‘state’)
at RouterProvider
When i was not using routes the app was working as intended but after using routes nothing is getting rendered on the page .
Please help me solve this error ?
2
Answers
try this code:-
Attention the attribute has changed to
router