hydrateFallbackElement
If you are using Server-Side Rendering and you are leveraging partial hydration, then you can specify an Element/Component to render for non-hydrated routes during the initial hydration of the application.
hydrateFallbackElement={<MyFallback />}
) you may specify an HydrateFallback
component instead (i.e., HydrateFallback={MyFallback}
) and React Router will call createElement
for you internally.
let router = createBrowserRouter(
[
{
id: "root",
path: "/",
loader: rootLoader,
Component: Root,
children: [
{
id: "invoice",
path: "invoices/:id",
loader: loadInvoice,
Component: Invoice,
HydrateFallback: InvoiceSkeleton,
},
],
},
],
{
future: {
v7_partialHydration: true,
},
hydrationData: {
root: {
/*...*/
},
// No hydration data provided for the `invoice` route
},
}
);
null
at that route level, so it is recommended that you always provide your own fallback element.