mirror of
https://github.com/t4t5/nostr-react.git
synced 2025-03-17 13:31:43 +01: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. 🎉
|
||||
|
||||
```tsx
|
||||
import { useProfile } from "nostr-react";
|
||||
|
||||
const Profile = () => {
|
||||
const userData = useProfile({
|
||||
const { data: userData } = useProfile({
|
||||
pubkey,
|
||||
});
|
||||
|
||||
|
@ -105,7 +105,11 @@ export function useProfile({ pubkey }: { pubkey: string }) {
|
||||
const npub = nip19.npubEncode(pubkey)
|
||||
|
||||
return {
|
||||
...metadata,
|
||||
npub,
|
||||
data: metadata
|
||||
? {
|
||||
...metadata,
|
||||
npub,
|
||||
}
|
||||
: undefined,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user