# useCroct

Learn how to access the SDK instance.

This hook gets the instance of the SDK initialized by the [`<CroctProvider>`](../components/croct-provider) component, providing access to the [Plug API](/reference/sdk/javascript/api/plug).

## Signature

This hook has the following signature:

```ts
function useCroct(): Plug;
```

The return is the [Plug](/reference/sdk/javascript/api/plug) instance.

## Example

Here is an example of how to use this hook:

**JavaScript**

```jsx
import {useCroct} from '@croct/plug-next';

export function SignupButton() {
const croct = useCroct();

function onClick() {
  croct.track('goalCompleted', {
    goalId: 'ctaClicked',
  });
}

return (<a href="/signup" onClick={onClick}>Sign up</a>);
}
```

**TypeScript**

```tsx
import type {ReactElement} from 'react';
import {useCroct} from '@croct/plug-next';

export function SignupButton(): ReactElement {
const croct = useCroct();

function onClick(): void {
  croct.track('goalCompleted', {
    goalId: 'ctaClicked',
  });
}

return (<a href="/signup" onClick={onClick}>Sign up</a>);
}
```
