Skip to content

Commit

Permalink
Merge pull request #1447 from ably/react-migration-guide-update
Browse files Browse the repository at this point in the history
docs: add array -> object hook return values to react migration guide
  • Loading branch information
owenpearson authored Sep 25, 2023
2 parents d735e23 + 1d38537 commit ec653f1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/react-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## Version 2.x to 3.x

### Hooks now return object

In previous versions of our react hooks, the `useChannel` and `usePresence` hooks returned arrays.
Since these hooks now return more values we've opted to change them to return objects.
You can still access the return values using simple destructuring syntax like in the below example:

```jsx
const { channel, ably } = useChannel("your-channel-name", (message) => { /* ... */ });

const { presenceData, updateStatus } = usePresence("your-channel-name");
```

### Replacing `configureAbly` with `AblyProvider`

In versions 1 and 2 of our react-hooks, we exported a function called `configureAbly` which was used to register an Ably client instance to global state.
Expand Down

0 comments on commit ec653f1

Please sign in to comment.