0
0
Remixframework~20 mins

Creating routes in Remix - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Remix Routing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2: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>;
}
AA page showing the text: 'Welcome to Remix!'
BA blank page with no content
CAn error message because the component is missing a return statement
DA page showing the text: 'Hello World!'
Attempts:
2 left
💡 Hint
Look at what the component returns inside the JSX.
📝 Syntax
intermediate
2: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?
ACreate a folder 'dashboard' with a file 'settings.tsx' inside it exporting a default component.
BCreate a file 'dashboard-settings.tsx' at the root routes folder exporting a default component.
CCreate a file 'dashboard.tsx' and inside it define a nested component for settings.
DCreate a folder 'settings' with a file 'dashboard.tsx' inside it exporting a default component.
Attempts:
2 left
💡 Hint
Nested routes in Remix use folders for parent routes and files inside for children.
state_output
advanced
2: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!' });
}
AA blank response with status 204
BA JavaScript error because json is not imported
C{"message":"Hello from loader!"}
DAn HTML page with the text 'Hello from loader!'
Attempts:
2 left
💡 Hint
The loader returns a JSON response using Remix's json helper.
🔧 Debug
advanced
2: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>;
}
AThe default export is missing, so the route cannot render.
BThe loader must return a Response or use Remix's json helper, returning a plain object causes an error.
CThe file name 'profile.tsx' is invalid for a route.
DThe loader function must be async, synchronous loaders are not allowed.
Attempts:
2 left
💡 Hint
Check what the loader function returns and Remix's expected format.
🧠 Conceptual
expert
3: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'?
Aroutes/blog/$year.tsx
Broutes/blog/$year/$month.tsx
Croutes/blog.tsx
Droutes/blog/$year/$month/$day.tsx
Attempts:
2 left
💡 Hint
Remix matches routes by the most specific path segments first.