select option, getting type errors.
how to fix this it should automatically get from react query No ? with out callback its working

3 Replies
sensitive-blueOP•3y ago
@TkDodo 🔮 kindly guide how to fix
modern-teal•3y ago
kindly show a sandbox or ts playground instead of an image
sensitive-blueOP•3y ago
const useInfiniteMovies = (query: QueryType) => {
return useInfiniteQuery({
queryKey: [INFINITE_MOVIES_CACHE_KEY, { ...query, page: 'here need to pass page param' }],
queryFn: ({ pageParam = 1 }) =>
getYtsData<IMoviesResponse>('/list_movies.json', {
params: { ...query, page: pageParam },
}),
getNextPageParam: lastPage => {
const data = lastPage.data
return data.movie_count >= MOVIES_LIMIT ? data.page_number + 1 : undefined
},
keepPreviousData: true,
})
}
export default useInfiniteMovies how we can pass this pageparam as queryKey is it possible ?
@TkDodo 🔮