# react-native: useRegion URL: https://generaltranslation.com/ja/docs/react-native/api/helpers/use-region.mdx --- title: useRegion description: useRegion Hook の API リファレンス --- {/* 自動生成: 直接編集せず、代わりに content/docs-templates/ 内の template を編集してください。 */} ## 概要 `useRegion` Hook は、[`` コンテキスト](/docs/react-native/api/components/gtprovider) から、ユーザーが現在選択しているリージョンを取得します。 `useRegion` はクライアント側の Hook であり、*クライアント側のコンポーネントでのみ使用できます*。 アプリが [``](/docs/react-native/api/components/gtprovider) でラップされていることを確認してください。 ## リファレンス ### 戻り値 `string | undefined` — 現在有効なリージョンコード (例: `"US"`、`"CA"`) 。リージョンが設定されていない場合は `undefined` です。 *** ## 例 ### 基本的な使い方 ```jsx title="RegionDisplay.jsx" copy 'use client'; import { useRegion } from 'gt-react-native'; export default function RegionDisplay() { const region = useRegion(); // [!code highlight] return

Current region: {region ?? 'Not set'}

; } ``` *** ## 注記 * ユーザーがリージョンを選択していない場合は、`undefined` が返されます。 * リージョンは、[``](/docs/react-native/api/components/region-selector) コンポーネントまたは [`useRegionSelector`](/docs/react-native/api/helpers/use-region-selector) Hook で設定できます。 ## 次のステップ * ユーザーがリージョンを選択できるようにするには、[``](/docs/react-native/api/components/region-selector)を使用します。 * カスタムのリージョンセレクターを作成するには、[`useRegionSelector`](/docs/react-native/api/helpers/use-region-selector)を使用します。