0.0.23 • Published 8 months ago

@rss3/api-react-query v0.0.23

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

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.

0.0.23

8 months ago

0.0.22

8 months ago

0.0.21

8 months ago