Complete the code to import the main component from the root of a Remix app.
import [1] from '~/root';
In Remix, the root component is imported from '~/root' using the conventional name 'App'.
Complete the code to define a route component inside the Remix 'routes' folder.
export default function [1]() { return <div>Hello Remix!</div>; }
The default route component in Remix is named 'Index' for the root path.
Fix the error in the Remix loader function to fetch data.
export async function loader() {
const data = await fetch('/api/data').then(res => res.[1]());
return { data };
}The fetch response object has a method 'json()' to parse JSON data.
Fill both blanks to create a Remix form that submits data with POST method.
<form method=[1] action=[2]> <button type="submit">Send</button> </form>
The form method should be uppercase 'POST' and the action is the URL path like '/submit'.
Fill all three blanks to create a Remix loader that returns JSON data with a status code.
import { json } from '@remix-run/node'; export async function loader() { const data = { message: 'Hello' }; return json(data, { status: [1], headers: { 'Content-Type': [2] } }); } // Use this in the component: // const response = useLoaderData(); // returns [3]
The loader returns JSON with status 200 and content type 'application/json'. The component receives the 'data' object.