diff --git a/docs/react.md b/docs/react.md index 0eb0223b32..171a2fffab 100644 --- a/docs/react.md +++ b/docs/react.md @@ -1,6 +1,6 @@ # ably-js React Hooks -> [!IMPORTANT] +> [!IMPORTANT] > The ably-js React Hooks are currently in the release candidate phase, and there may be breaking changes in a future non-major release. Use Ably in your React application using idiomatic, easy to use, React Hooks! @@ -120,21 +120,12 @@ const history = channel.history((err, result) => { }); ``` -It's also worth highlighting that the `useChannel` hook supports all of the additional parameters that the regular Ably SDK does as we're simply passing the call along. See the [Ably Channel docs](https://ably.com/docs/channels) for more info. +We support providing [ChannelOptions](https://ably.com/docs/api/realtime-sdk/types#channel-options) to the `useChannel` hook: This means you can use features like `rewind`: ```javascript -const { channel } = useChannel("[?rewind=100]your-channel-name", (message) => { - // This call will rewind 100 messages - console.log(message); -}); -``` - -We support providing [ChannelOptions](https://ably.com/docs/api/realtime-sdk/types#channel-options) to the `useChannel` hook: - -```javascript -const { channel } = useChannel({ channelName: "your-channel-name", options: { ... } }, (message) => { +const { channel } = useChannel({ channelName: "your-channel-name", options: { params: { rewind: '1' } } }, (message) => { ... }); ``` @@ -173,7 +164,7 @@ The usePresence hook lets you [subscribe to presence events on a channel](https: ```javascript const { presenceData, updateStatus } = usePresence("your-channel-name"); -// Convert presence data to list items to render +// Convert presence data to list items to render const peers = presenceData.map((msg, index) =>