Layouts, Loading States and Error Boundaries — Concept Check
Questions on Layouts, Loading States and Error Boundaries. A layout persists across navigation while its children change. loading.tsx and error.tsx are Suspense and error boundaries you get by naming a file.
Questions in this quiz
8 questions on Layouts, Loading States and Error Boundaries — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You navigate from /dashboard to /dashboard/billing in an app using nested layouts. Which component is re-rendered?
- AThe entire application layout
- BOnly the page component for /dashboard/billing
- CThe sidebar and the page component for /dashboard/billing
- DBoth the root and dashboard layouts
2.A developer wants to ensure that a loading state matches the final layout to prevent layout shifts. What should they use?
- AA generic loading spinner
- BA placeholder text
- CA skeleton that matches the real layout
- DA static image
3.An application uses loading.tsx at the top level. What is a potential downside?
- AThe entire page waits for the slowest query
- BIt prevents any loading state from appearing
- CEach segment loads independently
- DIt improves overall loading speed
4.What happens if an error occurs in the root layout of an app using error.tsx?
- Aerror.tsx catches and handles it
- BThe segment below the root layout catches it
- CThe application crashes completely
- DThe error is not caught by error.tsx
5.A developer mistakenly believes that data fetched in a layout refreshes on navigation between its children. What should they do instead?
- AUse global state management
- BFetch data per page instead of in the layout
- CRely on the layout to refresh data
- DUse a template.tsx to refresh data
6.A user reports that navigating between pages causes the layout to reset unexpectedly. What might be the cause?
- AUsing template.tsx instead of layout.tsx
- BMissing loading.tsx file
- CIncorrectly implemented error boundaries
- DImproper use of Suspense components
7.What is the role of error.tsx in an application?
- ATo render a 404 page for missing routes
- BTo globally handle all application errors
- CTo handle errors within its segment and below
- DTo display a loading state during data fetching
8.A developer uses notFound() inside a try/catch block. What is the consequence?
- AThe control-flow exception is swallowed
- BThe application crashes
- CA 404 status is sent despite the block
- DThe nearest not-found.tsx renders correctly