Files
Andrew ClarkandGitHub 7bce97d648 [experiment] Add useOffline hook to expose offline state to userland (#92012)
**Previous:**

1. https://github.com/vercel/next.js/pull/92011

**Current:**

2. (this PR)

---

Adds a `useOffline()` hook exported from `next/navigation` that returns
`true` when the app is offline. The state is owned by a provider
component rendered in the app router, using `useState` + `useOptimistic`
so the value can update even during blocked transitions (e.g., a
navigation that's waiting for connectivity).

Gated behind `experimental.useOffline`.
2026-03-27 18:25:26 -07:00

17 lines
261 B
TypeScript

import { OfflineStatus } from '../components/offline-status'
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html>
<body>
<OfflineStatus />
{children}
</body>
</html>
)
}