Skip to main content
Version: 2.x.x

Video SDK useRoom Hook - React Native

Introduction​

useRoom() gives a component the room held by the nearest RoomProvider. Pass the room event callbacks you need, and use the properties and methods it returns.

Reading a property subscribes the component to it, so the component re-renders only for what it reads.

import { useRoom } from "@videosdk.live/react-native-sdk";

function Controls() {
const { join, leave, participants } = useRoom({
onRoomJoined: () => console.log("Joined"),
onError: (error) => console.log(error.code, error.message),
});

return null;
}

Properties​

Methods​

Event Callbacks​

Got a Question? Ask us on discord