Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add array -> object hook return values to react migration guide #1447

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading