# useTryYourSize()

> The TryYourSize client, or null until it has loaded.

Source: https://docs.tryyoursize.com/reference/react/use-tryyoursize/

*Hook* · `@tryyoursize/react`

The TryYourSize client, or null until it has loaded.

```ts
function useTryYourSize(): TryYourSizeClient | null
```

## Returns

`TryYourSizeClient | null`: The client, or `null` until it has loaded. Throws outside a provider.

## Example

**React**

```tsx
function SizeBadge({ sku }: { sku: string }) {
  const tys = useTryYourSize();
  const [size, setSize] = useState<string | null>(null);
  useEffect(() => {
    tys?.recommendation(sku).then((r) => setSize(r.status === "ready" ? r.size : null));
  }, [tys, sku]);
  return size ? <span>Your size: {size}</span> : null;
}
```
