> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daily.co/llms.txt
> Use this file to discover all available pages before exploring further.

# useNetwork

> Returns current information about network quality and topology.

`useNetwork(params?): Object`

`useNetwork` can also be used to set up optional callbacks for `daily-js` [network events](/reference/daily-js/events/network-events).

## Parameters (optional)

<ParamField body="onNetworkQualityChange" type="Function">
  Event callback for the [`network-quality-change`](/reference/daily-js/events/network-events#network-quality-change) event
</ParamField>

<ParamField body="onNetworkConnection" type="Function">
  Event callback for the [`network-connection`](/reference/daily-js/events/network-events#network-connection) event
</ParamField>

## Return value

An object with the following properties:

<ResponseField name="getStats" type="Function">
  Details the latest network stats, equivalent to calling [`getNetworkStats()`](/reference/daily-js/instance-methods/get-network-stats)
</ResponseField>

<ResponseField name="networkState" type="string">
  `'good' | 'warning' | 'bad' | 'unknown'`, check [getNetworkStats()](/reference/daily-js/instance-methods/get-network-stats#return-value) for details
</ResponseField>

<ResponseField name="networkStateReasons" type="Array<string>">
  Possible reasons are `'sendPacketLoss' | 'recvPacketLoss' | 'roundTripTime' | 'availableOutgoingBitrate'`, check [getNetworkStats()](/reference/daily-js/instance-methods/get-network-stats#return-value) for details
</ResponseField>

<ResponseField name="networkStatus" type="string">
  `'connected' | 'interrupted'`, the current network connection status
</ResponseField>

<ResponseField name="quality" type="number">
  <Badge variant="warning">Deprecated 0.23.0</Badge> A subjective calculation of the current network quality on a scale of 1-100, defaults to `100`
</ResponseField>

<ResponseField name="threshold" type="string">
  <Badge variant="warning">Deprecated 0.23.0</Badge> `'good' | 'low' | 'very-low'`, an assessment of the current network quality. The threshold value is calculated from network stats averaged over an approximately 30-second rolling window. By default, we lower the bandwidth used for the call when the network quality drops to `'low'`; defaults to `'good'`
</ResponseField>

<ResponseField name="topology" type="string">
  `'none' | 'peer' | 'sfu'`, the [network connection type](/docs/guides/architecture-and-monitoring/intro-to-video-arch#the-architecture-of-a-room-p2p-vs-sfu-calls) of the current call, defaults to `'none'`
</ResponseField>

```json theme={null}
{
  "getStats": <Function>,
  "networkState": "good",
  "networkStateReasons": [],
  "networkStatus": "connected",
  "quality": 100,
  "threshold": "good",
  "topology": "sfu",
}
```

## Example

```jsx theme={null}
import { useNetwork } from '@daily-co/daily-react';

export const UseNetworkDemo = () => {
  const network = useNetwork();

  return <div>Network state: {network.networkState}</div>;
};
```

## See also

<CardGroup>
  <Card title="daily-js methods" icon="code" iconType="solid">
    * [getNetworkStats()](/reference/daily-js/instance-methods/get-network-stats)
  </Card>

  <Card title="Events" icon="bolt" iconType="solid">
    * [network-quality-change](/reference/daily-js/events/network-events#network-quality-change)
    * [network-connection](/reference/daily-js/events/network-events#network-connection)
  </Card>
</CardGroup>
