Next.js · Senior · Question 54 of 75
Why does useOffline() from next/offline always return false in a project?
- ✓Correct answer: The
experimental.useOfflineflag isn't enabled innext.config - 2It works only in Server Components
- 3It needs a service worker registered manually
Explanation
The flag turns on connectivity detection and automatic retry of blocked navigations, prefetches and Server Actions. The hook is also false on the server and before hydration.