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

# Channel State

> As well as transient messages, channels can be used as a store for realtime, stateful and persisted state. You can think of it like a realtime database attached to every channel.

Channel state is stored under `state` in the Channel object. State is a
key/value map, which you can provide when creating a Channel, and then update
later on. All subscribers are able to access Channel state. When state is
updated, all subscribers will be synced with the latest state object. You can
also listen to the individual state update events with the client SDK.

## Updating State

You can update channel state from the server side SDK libraries or the API.

* [Reference: Updating State](./reference/updating-channel-state)

### Usage with React

If using React, you can use the `useReadChannelState` hook:

```jsx Price.jsx theme={null}
const Price = () => {
	/**
	 * `state` will be null until the client is connected
	 * this will attempt to subscribe the client to the specified channel
	 * if they are not already subscribed (you can disable this)
	 */

	const {state} = useReadChannelState('usd_prices');

	if (!state) {
		return;
		<h1>Loading</h1>;
	}

	return <h1>BTC Price: {state.btc}</h1>;
};
```
