In React Testing Library tests, keep assertions outside components, and rely on proper global teardown.

Example (asserting after render, without component-level expect):

function Page() {
  const { canFetchMore } = useInfiniteQuery(
    'items',
    (key, nextId = 0) => fetchItems(nextId),
    { initialData: [/* ... */] }
  )

  return <div data-testid="can-fetch-more">{String(canFetchMore)}</div>
}

const { getByTestId } = render(<Page />)
expect(getByTestId('can-fetch-more').textContent).toBe('true')