Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a basic Remix route component.
Remix
export default function Index() {
return <h1>[1]</h1>;
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around text in JSX
Using angle brackets incorrectly
✗ Incorrect
The text inside JSX must be a string wrapped in quotes.
2fill in blank
mediumComplete the code to import the Link component from Remix.
Remix
import { [1] } from "@remix-run/react";
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Importing Route instead of Link
Using Navigate which is from React Router
✗ Incorrect
The Link component is used for navigation in Remix.
3fill in blank
hardFix the error in the loader function to return JSON data.
Remix
import { json } from "@remix-run/node"; export async function loader() { return [1]({ message: "Hello from loader" }); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Returning raw objects without json()
Using fetch inside loader incorrectly
✗ Incorrect
The json function formats data properly for Remix loaders.
4fill in blank
hardFill both blanks to create a Remix form that submits data.
Remix
<form method=[1] action=[2]> <button type="submit">Send</button> </form>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get' method for data submission
Wrong action URL causing form to fail
✗ Incorrect
Forms use method 'post' and action URL to submit data in Remix.
5fill in blank
hardFill all three blanks to create a loader that fetches data and returns JSON.
Remix
import { json } from "@remix-run/node"; export async function loader() { const response = await fetch([1]); const data = await response.[2](); return [3](data); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using json() on response instead of text()
Not wrapping returned data with Remix json()
✗ Incorrect
Fetch URL is a string, response.text() reads text, json() wraps data for Remix.