State Management · Junior · Question 49 of 75
What is a loader in React Router?
- ✓Correct answer: A function that loads a route's data before it renders
- 2A spinner component shown while a page loads
- 3A function that lazy-loads the route's JS code
Explanation
The router calls the loader on navigation and the component reads the result with useLoaderData() (or via props in framework mode). Data loading starts with navigation instead of after render, which avoids request waterfalls.