diff --git a/README.md b/README.md index d8c06a3..2353ff1 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,26 @@ const ProfileFeed = () => { }; ``` +**Fetching user profiles** + +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 +const Profile = () => { + const userData = useProfile({ + pubkey, + }); + + return ( + <> +
Name: userData?.name
+Public key: userData?.npub
+Picture URL: userData?.avatarUrl
+ > + ) +} +``` + **Post a message:** ```tsx