@towns-protocol/react-sdk
Version:
React Hooks for Towns Protocol SDK
16 lines • 639 B
JavaScript
'use client';
import { useObservable } from './useObservable';
import { useSyncAgent } from './useSyncAgent';
/**
* Hook to get an observable from the sync agent.
*
* An alternative of our premade hooks, allowing the creation of custom abstractions.
* @param selector - A selector function to get a observable from the sync agent.
* @param config - Configuration options for the observable.
* @returns The data from the selected observable.
*/
export function useTowns(selector, config) {
const syncAgent = useSyncAgent();
return useObservable(selector(syncAgent.observables), config);
}
//# sourceMappingURL=useTowns.js.map