Summary - Layout components
- React course
- Intermediate
- Lesson 52/80
- 5 min
Write a DashboardLayout with header, sidebar and main content.
Summary - Layout components
In this group you learned the layout pattern, the sidebar and header structure, and Outlet usage. The layout writes the frame once; every page shares it.
The sidebar holds links, the header holds the logo and menu. Outlet marks where child routes render. These three tools together build a consistent app skeleton.
In the last step you will combine the three pieces into one layout.
Practice Full layout
Complete the skeleton below. Write an AppLayout component; return a div containing <header>, <Sidebar />, <Outlet /> and <footer>. Export it.
Starter code
import { Outlet } from "react-router-dom";
// Write the AppLayout component hereSample solution
import { Outlet } from "react-router-dom";
function AppLayout() {
return (
<div>
<header>Başlık</header>
<Sidebar />
<Outlet />
<footer>Alt bilgi</footer>
</div>
);
}
export default AppLayout;Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which renders the child route?
- Outlet Correct answer
- Header
- Footer
- Sidebar
Explanation: Outlet renders the child route.
2 Summary match
| Term | Meaning |
|---|---|
Layout |
Frame |
Sidebar |
Left menu |
Outlet |
Child route |
header |
Top area |