#
useIsBootstrapping
Indicate whether the application is currently being bootstrapped, such as registering modules, handling deferred registrations, preparing Mock Service Worker, fetching global data, etc.
#
Reference
const isBootstrapping = useIsBootstrapping();
#
Parameters
None
#
Returns
A boolean
value indicating whether or not the application is bootstrapping.
#
Usage
A BootstrappingRoute
component is introduced in the following example because this hook must be rendered as a child of rootRoute
.
host/src/App.tsx
import { useIsBootstrapping, AppRouter } from "@squide/firefly";
import { RouterProvider, createBrowserRouter, Outlet } from "react-router-dom";
function BootstrappingRoute() {
if (useIsBootstrapping()) {
return <div>Loading...</div>;
}
return <Outlet />;
}
export function App() {
return (
<AppRouter waitForMsw={false}>
{({ rootRoute, registeredRoutes, routerProviderProps }) => {
return (
<RouterProvider
router={createBrowserRouter([
{
element: rootRoute,
children: [
{
element: <BootstrappingRoute />,
children: registeredRoutes
}
]
}
])}
{...routerProviderProps}
/>
);
}}
</AppRouter>
);
}