mirror of
https://github.com/t4t5/nostr-react.git
synced 2025-06-19 04:50:48 +02:00
Update useProfile return value
This commit is contained in:
parent
53b738f4c8
commit
6b74638f21
@ -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. 🎉
|
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
|
```tsx
|
||||||
|
import { useProfile } from "nostr-react";
|
||||||
|
|
||||||
const Profile = () => {
|
const Profile = () => {
|
||||||
const userData = useProfile({
|
const { data: userData } = useProfile({
|
||||||
pubkey,
|
pubkey,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -105,7 +105,11 @@ export function useProfile({ pubkey }: { pubkey: string }) {
|
|||||||
const npub = nip19.npubEncode(pubkey)
|
const npub = nip19.npubEncode(pubkey)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...metadata,
|
data: metadata
|
||||||
npub,
|
? {
|
||||||
|
...metadata,
|
||||||
|
npub,
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user