How should I structure a React layout component with Navbar and Outlet?i
I am working on a React app using react-router-dom. I have a layout component that renders a Navbar, an Outlet, and also accepts children. I also have a reusable Hero component for page headers. The code works, but I am confused about the correct structure. Should a layout component use Outlet, children, or both? Also, should reusable page components like Hero be kept separate from the routing layout? Here are the relevant files: import { Navigate, Outlet, Route, Routes, useLocation } from "react-router-dom"; import { useAuth } from "../context/AuthContext"; import Navbar from "../components/N
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.