Skip to Content
APIReactConnectivity

Connectivity

Component that switches between children and fallback based on connectivity.

Signature

function Connectivity(props: ConnectivityProps): ReactElement;

Props

PropTypeDefaultDescription
childrenReactNode(required)UI shown when online
fallbackReactNodenullReplacement UI when offline
delayMsnumber0Delay before switching to fallback (ms)

Defaults for fallback and delayMs come from ConnectivityProvider’s defaultOptions.connectivity.

Example

<Connectivity fallback={<OfflineBanner />} delayMs={2_000}> <App /> </Connectivity>

Behavior

  • unknown treated as online (SSR-safe)
  • delayMs > 0: children maintained for the delay period after going offline
  • Recovery within delay: fallback never shown
Last updated on