I am trying to get the previous data using react query, is there any way to get it?
I have a custom hook, it updates every time with new data when I scroll down, But when I get the new data I lost the previous data, so I want to get the previous data
const useActivityFeedData = (
activityFeedPageIndex: number,
pageSize = Config.defaultPageSize,
) =>
useQuery(
[ACTIVITY_FEED, activityFeedPageIndex],
() => Api.user.getActivityFeedData(activityFeedPageIndex, pageSize),
{
initialData: {
activityList: [],
},
keepPreviousData: true,
select: (res: any) => ({
activityList: res.activityList,
}),
},
);