docs
docs copied to clipboard
How to use Ably with React tutorial syntax update required
Step 4 of the tutorial https://ably.com/tutorials/how-to-ably-react-hooks#tutorial-step-4 has the following syntax on how to use rewind
const {channel} = useChannel("[?rewind=100]your-channel-name", (message) => {
// List the last 100 messages on the channel
console.log(message);
});
However this does not work and the correct syntax would now be
const { channel } = useChannel({ channelName: "your-channel-name", options: { params: { rewind: '100' } } }, (message) => {
console.log(message);
});
Which has been updated in the ably-js repo React readme https://github.com/ably/ably-js/pull/1523