Quickstart
💡
We have upgraded our SDK to v2 (2.x.x)
. For the previous stable release, please visit here
Installation
To get started with the Huddle01 React SDK, you can install the package using npm or yarn:
pnpm install @huddle01/react
Initializing the SDK:
First you need to configure HuddleProvider in your root component.
import { HuddleProvider, HuddleClient } from '@huddle01/react';
const huddleClient = new HuddleClient({
projectId: env.NEXT_PUBLIC_PROJECT_ID,
options: {
activeSpeakers: {
size: 8,
},
},
});
...
<HuddleProvider client={huddleClient}>
<App />
</HuddleProvider>
...
Joining Room
import { useRoom } from '@huddle01/react/dist/hooks';
const { joinRoom } = useRoom({
onJoin: () => {
console.log('Joined room');
}
});
// join room
joinRoom({
roomId: "YOUR_ROOM_ID",
token: "YOUR_TOKEN"
});