1. 4
    Fetch Data in Remix Using a Basic Loader
    2m 24s

Fetch Data in Remix Using a Basic Loader

InstructorKent C. Dodds

Share this video with your friends

Send Tweet

Loaders are used to get data into your components from the server. We can set up a loader by defining an async function named loader outside of our route component. That function will return a new Response, with some JSON in the case of this lesson.

Then to use the data in our component, we’ll use the nice useLoaderData hook that Remix gives us, which gets the data returned from your loader.

What’s extra cool is that in Remix your loaders will only run on the server. They won’t even be included in the browser bundle!