Update useProfile return value

This commit is contained in:
Tristan Edwards 2023-01-02 10:55:36 +01:00
parent 53b738f4c8
commit 6b74638f21
2 changed files with 9 additions and 3 deletions

View File

@ -91,8 +91,10 @@ const ProfileFeed = () => {
Use the `useProfile` hook to render user profiles. You can use this in multiple components at once (for example, rendering a name and avatar for each message in a chat), the hook will automatically use *batching* to prevent errors where a client sends too many requests at once. 🎉
```tsx
import { useProfile } from "nostr-react";
const Profile = () => {
const userData = useProfile({
const { data: userData } = useProfile({
pubkey,
});

View File

@ -105,7 +105,11 @@ export function useProfile({ pubkey }: { pubkey: string }) {
const npub = nip19.npubEncode(pubkey)
return {
...metadata,
npub,
data: metadata
? {
...metadata,
npub,
}
: undefined,
}
}