UNPKG

@towns-protocol/react-sdk

Version:

React Hooks for Towns Protocol SDK

22 lines 937 B
import type { Space } from '@towns-protocol/sdk'; import { type ObservableConfig } from './useObservable'; /** * Hook to get data about a space. * You can use this hook to get space metadata and ids of channels in the space. * @param spaceId - The id of the space to get data about. * @param config - Configuration options for the observable. * @returns The SpaceModel data. * @example * You can use this hook to display the data about a space: * * ```tsx * import { useSpace } from '@towns-protocol/react-sdk' * * const Space = ({ spaceId }: { spaceId: string }) => { * const { data: space } = useSpace(spaceId) * return <div>{space.metadata?.name || 'Unnamed Space'}</div> * } * ``` */ export declare const useSpace: (spaceId: string, config?: ObservableConfig.FromObservable<Space>) => import("./useObservable").ObservableValue<import("@towns-protocol/sdk").SpaceModel>; //# sourceMappingURL=useSpace.d.ts.map