default export
The React component that renders when the route matches.Signature
Basic Example
Using Loader Data
Nested Routes with Outlet
With Actions and Forms
Navigation and Params
Async Components
Components cannot be async. Use loaders for data fetching:Component Naming
You can use any valid function name:Best Practices
Use semantic HTML
Use semantic HTML
Structure your components with proper HTML elements:
Keep components focused
Keep components focused
Extract complex UI into separate components:
Handle loading and error states
Handle loading and error states
Use hooks to handle different states:
Use TypeScript for type safety
Use TypeScript for type safety
Leverage type inference from loaders and actions:
See Also
- useLoaderData - Access loader data
- useActionData - Access action data
- Outlet - Render child routes
- ErrorBoundary - Handle errors