0

Unable to render data - Blank webpage

Help me figure out what's the issue here: https://stackoverflow.com/questions/74455230/uncaught-error-publicroute-is-not-a-route-component-all-component-children I'm trying to render <PublicRoute> and </PrivateRoute> components but the webpage is blank, even though there're no errors or warnings.

24th Nov 2022, 5:59 AM
Asha
Asha - avatar
2 Answers
0
import ReactDOM from "react-dom/client"; import { BrowserRouter, Routes, Route } from "react-router-dom"; import Layout from "./pages/Layout"; import Home from "./pages/Home"; import Blogs from "./pages/Blogs"; import Contact from "./pages/Contact"; import NoPage from "./pages/NoPage"; export default function App() { return ( <BrowserRouter> <Routes> <Route path="/" element={<Layout />}> <Route index element={<Home />} /> <Route path="blogs" element={<Blogs />} /> <Route path="contact" element={<Contact />} /> <Route path="*" element={<NoPage />} /> </Route> </Routes> </BrowserRouter> ); } const root = ReactDOM.createRoot(document.getElementById('root')); root.render(<App />);
25th Nov 2022, 3:11 PM
S3R43o3
S3R43o3 - avatar
0
The post before is an example, did you make sure that xou have install all dependencies and do the right imports ? Specially react-router-dom ?
25th Nov 2022, 3:12 PM
S3R43o3
S3R43o3 - avatar