# General Translation React SDKs (gt-react, gt-next, gt-react-native): useSetRegion
URL: https://generaltranslation.com/en-US/docs/react/reference/hooks/use-set-region.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Change the active region. API reference for useSetRegion.

The `useSetRegion` hook returns a function that changes the active region. It is client-side only.

*Available in `gt-react` and `gt-react-native`.*

*Note: not exported by `gt-next` or `gt-tanstack-start`.*

## Overview [#overview]

Call `useSetRegion` to get the setter, then call it with a region code.

*Examples import from `gt-react`; import from your framework's package instead.*

```tsx
import { useSetRegion } from 'gt-react';

export default function RegionButton() {
  const setRegion = useSetRegion();
  return <button onClick={() => setRegion('CA')}>Switch to Canada</button>;
}
```

*Note: `useSetRegion` is client-side only and must be used under a [`<GTProvider>`](/docs/react/reference/components/gt-provider).*

## How it works [#how-it-works]

Calling the returned function persists the chosen region in a cookie and reloads the page so region-specific formatting is applied. Passing `undefined` clears the region.

## Returns [#returns]

**Type** `(region: string | undefined) => void`

A function that sets the active region to the given code, or clears it when passed `undefined`.

## Notes [#notes]

- `useSetRegion` is client-side only.
- To read the active region, use [`useRegion`](/docs/react/reference/hooks/use-region). For a ready-made switcher, use [`<RegionSelector>`](/docs/react/reference/components/region-selector).

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
