# useCancelRecoveryRequest

## Description

This hook allows you to cancel a recovery request.

## Parameters

```typescript
type CancelRecoveryRequestParams = {
    rpcUrl?: string;
};
```

## Example

```typescript
import { useCancelRecoveryRequest } from "@/hooks/useCancelRecoveryRequest";

export const CancelRecoveryButton = () => {
  const {
    cancelRecoveryRequest,
    cancelRecoveryRequestAsync,
    isLoading,
    isError,
    error,
    isSuccess,
    data
  } = useCancelRecoveryRequest();

  const handleCancel = async () => {
    try {
      const result = await cancelRecoveryRequestAsync({
        rpcUrl: 'https://my-rpc-url.com',
      });
      console.log('Recovery request canceled successfully:', result);
    } catch (error) {
      console.error('Error canceling recovery request:', error);
    }
  };

  return (
    <div>
      <button onClick={handleCancel} disabled={isLoading}>
        Cancel Recovery Request
      </button>
      {isLoading && <p>Canceling recovery request...</p>}
      {isError && <p>Error: {error?.message}</p>}
      {isSuccess && <p>Recovery request canceled successfully. Hash: {data}</p>}
    </div>
  );
};
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cometh.io/integrations/react-hooks/recovery/usecancelrecoveryrequest.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
