Loading
Current section: Testing Remix 4 exercises
Problem

Creating a Parent Route for Accessing Root Data

Loading exercise

Transcript

00:00 We've got another test that Kelly put together for us for the authenticated side of this, and it's not working right now. It's failing for us. And the reason that it's failing is because to determine whether the user that is viewing this profile is a logged in user, they're looking at their own profile,

00:18 is based on this useOptionalUser hook. If we dive into that, that useOptionalUser hook is calling useRouteLoaderData for the root. And yeah, that ID of root is actually very important. That's the data that's coming from our root loader, which is selecting the user

00:37 and then providing that user here. So we need to have this data available on the page under a route with the ID of root so that that can be accessed here as we're rendering this stuff. So your job is to add another route to this that is a parent route of our route here

00:56 so that we have access to that root route data as part of the testing process. So this is just getting us a little bit closer to the real environment where this username route is being rendered. So that is your task for this one. Have a good time.