"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useRoom = useRoom;
var _react = require("react");
var _tsSdkReactNative = require("@amityco/ts-sdk-react-native");
function useRoom(roomId) {
  const [room, setRoom] = (0, _react.useState)(null);
  (0, _react.useEffect)(() => {
    let unsubscribe;
    if (roomId) {
      unsubscribe = _tsSdkReactNative.RoomRepository.getRoom(roomId, ({
        data
      }) => {
        setRoom(data);
      });
    }
    return () => {
      unsubscribe && unsubscribe();
    };
  }, [roomId]);
  return room;
}
//# sourceMappingURL=useRoom.js.map