Reference
React Channels implementation
How to subscribe to Channel messages and state using the Hop React SDK
useChannelMessage
You can use this hook to subscribe to Channel message events in your React app.
Example
This example assumes you have already initialized the Hop React SDK.
useReadChannelState
You can use this hook to subscribe to Channel state in your React app.
Hook Return Value
field | type | description |
---|---|---|
state | ?object | the channel state |
error | ?object | leap error (if failed to subscribe) |
subscription | enum | non_existent , pending , unavailable , or available |
Example
This example assumes you have already initialized the Hop React SDK.