@towns-protocol/react-sdk
Version:
React Hooks for Towns Protocol SDK
16 lines • 666 B
JavaScript
import { useMemo } from 'react';
import { useSyncAgent } from './useSyncAgent';
import { useObservable } from './useObservable';
/**
* Hook to get the data of a Group DM.
* You can use this hook to get Group DM metadata and if the user has joined the Group DM.
* @param streamId - The id of the Group DM to get the data of.
* @param config - Configuration options for the observable.
* @returns The GdmModel of the Group DM.
*/
export const useGdm = (streamId, config) => {
const sync = useSyncAgent();
const gdm = useMemo(() => sync.gdms.getGdm(streamId), [streamId, sync]);
return useObservable(gdm, config);
};
//# sourceMappingURL=useGdm.js.map