"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useUser = void 0;
var _tsSdkReactNative = require("@amityco/ts-sdk-react-native");
var _react = require("react");
const useUser = userId => {
  const [user, setUser] = (0, _react.useState)(null);
  (0, _react.useEffect)(() => {
    if (!userId) return;
    _tsSdkReactNative.UserRepository.getUser(userId, ({
      data,
      loading,
      error
    }) => {
      if (error) return undefined;
      if (!loading) {
        setUser(data);
      }
    });
  }, [userId]);
  return user;
};
exports.useUser = useUser;
//# sourceMappingURL=useUser.js.map