Challenge - 5 Problems
Remix Routing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What does this Remix route component render?
Consider this Remix route component code. What will be displayed on the page when this route is visited?
Remix
export default function RouteComponent() {
return <h1>Welcome to Remix!</h1>;
}Attempts:
2 left
💡 Hint
Look at what the component returns inside the JSX.
✗ Incorrect
The component returns an <h1> element with the text 'Welcome to Remix!'. This will be rendered on the page.
📝 Syntax
intermediate2:00remaining
Which option correctly defines a nested route in Remix?
You want to create a nested route under the path '/dashboard/settings'. Which file structure and code snippet correctly defines this nested route?
Attempts:
2 left
💡 Hint
Nested routes in Remix use folders for parent routes and files inside for children.
✗ Incorrect
In Remix, nested routes are created by folders and files. A folder named 'dashboard' with a file 'settings.tsx' inside creates the nested route '/dashboard/settings'.
❓ state_output
advanced2:00remaining
What is the output of this loader function in a Remix route?
Given this loader function in a Remix route, what will be the JSON response when the route is accessed?
Remix
import { json } from '@remix-run/node'; export async function loader() { return json({ message: 'Hello from loader!' }); }
Attempts:
2 left
💡 Hint
The loader returns a JSON response using Remix's json helper.
✗ Incorrect
The loader returns a JSON response with the object { message: 'Hello from loader!' }. The client receives this JSON string.
🔧 Debug
advanced2:00remaining
Why does this Remix route fail to load?
This route file is named 'profile.tsx' and contains this code. Why does the route fail to load?
Remix
import { json } from '@remix-run/node'; export function loader() { return { user: 'Alice' }; } export default function Profile() { return <div>Profile Page</div>; }
Attempts:
2 left
💡 Hint
Check what the loader function returns and Remix's expected format.
✗ Incorrect
Remix expects loader functions to return a Response object or use the json helper. Returning a plain object causes a runtime error.
🧠 Conceptual
expert3:00remaining
How does Remix determine which route file to load for the URL '/blog/2024/06/15'?
Given these route files in Remix:
- routes/blog.tsx
- routes/blog/$year.tsx
- routes/blog/$year/$month.tsx
- routes/blog/$year/$month/$day.tsx
Which route file will Remix use to render the URL '/blog/2024/06/15'?
Attempts:
2 left
💡 Hint
Remix matches routes by the most specific path segments first.
✗ Incorrect
Remix matches the route with the most path segments matching the URL. For '/blog/2024/06/15', the file with three dynamic segments $year/$month/$day.tsx is the correct match.