@rss3/api-react-query
v0.0.23
Published
<p align="center"> <img src="https://raw.githubusercontent.com/RSS3-Network/web3-icons/main/icons/rss3-alt-3.svg" alt="RSS3 Logo" width="200" /> </p>
Downloads
7
Readme
RSS3 React Query SDK
React Query hooks for the RSS3 JavaScript SDK.
- Easy integration with React applications using React Query
- Fully typed hooks for all RSS3 API endpoints
- Optimized for performance with built-in caching and request deduplication
Installation
npm i @rss3/api-react-query @tanstack/react-query
Note: This package requires @tanstack/react-query
as a peer dependency.
Getting Started
First, set up the React Query provider in your app:
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
const queryClient = new QueryClient()
function App() {
return (
<QueryClientProvider client={queryClient}>
{/* Your app components */}
</QueryClientProvider>
)
}
Then, you can use the hooks in your components:
Fetch Activities
import { useGetActivities } from '@rss3/api-react-query'
function ActivityFeed() {
const { data, isLoading, error } = useGetActivities({
account: "vitalik.eth",
tag: ["social"],
type: ["comment"],
platform: ["Farcaster"],
});
if (isLoading) return <div>Loading...</div>
if (error) return <div>Error: {error.message}</div>
return (
<ul>
{data?.map(activity => (
<li key={activity.id}>{activity.content}</li>
))}
</ul>
)
}
Documentation
For more detailed information about the available hooks and their usage, please refer to the RSS3 API documentation.
License
MIT.