Skip to content

React Hooks

useObservable

TODO

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}/>
}