import { useEffect, useState } from 'react';
import { RoomRepository } from '@amityco/ts-sdk-react-native';
export function useRoom(roomId) {
  const [room, setRoom] = useState(null);
  useEffect(() => {
    let unsubscribe;
    if (roomId) {
      unsubscribe = RoomRepository.getRoom(roomId, ({
        data
      }) => {
        setRoom(data);
      });
    }
    return () => {
      unsubscribe && unsubscribe();
    };
  }, [roomId]);
  return room;
}
//# sourceMappingURL=useRoom.js.map