1

I am using useQuery hook in React native android application to fetch the data. When my app starts I get initial rows as a prop from the native side to React native. Then React native layer gets the next page by using the useQuery.

As of now, I am using fetchMore function to merge initial data along with new but the pooling interval is not updating the initial data.

const dataCall = useQuery(QUERY, {
  variables: {
    startDateTimestampUTC: StartDate.current,
    endDateTimestampUTC: EndDate.current,
    paginationCursor: initialData.cursor,
    paginationSize: 12,
  },
  fetchPolicy: 'network-only',
  pollInterval: 5 * 60 * 1000,
  skip: initialData == null,
});

How can I use useQery with initial Data https://react-query.tanstack.com/docs/guides/initial-query-data along with pooling interval.

Thanks

Anhdevit
  • 1,926
  • 2
  • 16
  • 29
Pavan Tiwari
  • 3,077
  • 3
  • 31
  • 71

0 Answers0