How to use initial data with useQuery

854 views Asked by At

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

0

There are 0 answers