Skip to main content

_useCancelling

import { useSuspense, useCancelling } from '@data-client/react';
import { TodoResource } from './resources/Todo';

export default function TodoDetail({ id }: { id: number }) {
  const todo = useSuspense(useCancelling(TodoResource.get, { id }), {
    id,
  });
  return <div>{todo.title}</div>;
}
🔴 Live Preview
Store

Try clicking the » very quickly. If you increment before it resolves the request will be cancelled and you should not see results in the store.