React Hooks
useObservable
The useObservable
hook can be used to subscribe to the current and future values of an rxjs observable. its use internally in the useStoreQuery
hook to subscribe to the query
useQueryStore
The useQueryStore
hook can be used at access the QueryStore
from anywhere in the react tree
useStoreQuery
The useStoreQuery
hook can be used to run a Query in the QueryStore
and subscribe to the results
ts
function UserAvatar({ pubkey }: { pubkey: string }) {
const profile = useStoreQuery(ProfileQuery, [pubkey]);
// profile will be undefined until the event is loaded
return <img src={profile?.picture}/>
}