# @types/react-detect-offline

> TypeScript definitions for react-detect-offline

Latest version **2.4.6** (published 2025-11-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/react-detect-offline
pnpm add @types/react-detect-offline
yarn add @types/react-detect-offline
bun add @types/react-detect-offline
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.4.6 |
| Published | 2025-11-14 |
| First published | 2021-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51448 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/react-detect-offline
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-detect-offline
- npm.io page: https://npm.io/package/@types/react-detect-offline

## Dependencies (1)

- [@types/react](https://npm.io/package/@types/react.md) *

## Recent versions

- 2.4.6 (latest) — 2025-11-14
- 2.4.5 (ts4.6) — 2023-12-06
- 2.4.4 (ts4.5) — 2023-11-22
- 2.4.1 (ts3.7) — 2021-10-14
- 2.4.0 (ts3.6) — 2021-07-30
- 2.4.3 — 2023-11-07
- 2.4.2 — 2023-10-18

## README

# Installation
> `npm install --save @types/react-detect-offline`

# Summary
This package contains type definitions for react-detect-offline (https://github.com/cwise89/react-detect-offline#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-detect-offline.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-detect-offline/index.d.ts)
````ts
import { JSX } from "react";

export interface PollingConfig {
    /**
     * URL to pool for connection status
     */
    url: string;
    /**
     * Force polling on or off.
     * Polling is only used as a fallback for browsers that don't support the `"online"` event.
     * Currently these are Chrome on Windows, Firefox on Windows, and Chrome on Linux.
     */
    enabled: boolean;
    /**
     * How often (in ms) to poll
     */
    interval: number;
    /**
     * How long (in ms) before timeout
     */
    timeout: number;
}
export interface BaseProps {
    children?: React.ReactNode | undefined;
    /**
     * Called when connection changes
     */
    // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
    onChange?: ((online: boolean) => void | undefined) | undefined;
    wrapperType?: string | undefined;
    /**
     * Config for polling fallback
     */
    polling?: boolean | Partial<Omit<PollingConfig, "enabled">> | undefined;
}
export interface BaseState {
    online: boolean;
}
export const defaultProps: BaseProps;
export const defaultPollingConfig: PollingConfig;
export const Base: React.ComponentClass<BaseProps, BaseState>;
export interface DetectorProps extends BaseProps {
    render: ({ online }: { online: boolean }) => JSX.Element | null;
}
export interface DetectorState extends BaseState {}
export const Detector: React.ComponentClass<DetectorProps, DetectorState>;
export interface OnlineProps extends BaseProps {}
export interface OnlineState extends BaseState {}
export const Online: React.ComponentClass<OnlineProps, OnlineState>;
export interface OfflineProps extends BaseProps {}
export interface OfflineState extends BaseState {}
export const Offline: React.ComponentClass<OfflineProps, OfflineState>;

````

### Additional Details
 * Last updated: Fri, 14 Nov 2025 18:40:46 GMT
 * Dependencies: [@types/react](https://npmjs.com/package/@types/react)

# Credits
These definitions were written by [Rhythm Bhiwani](https://github.com/rhythmbhiwani).

---
_Source: https://npm.io/package/@types/react-detect-offline · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
