# react-native: useSetLocale URL: https://generaltranslation.com/zh/docs/react-native/api/helpers/use-set-locale.mdx --- title: useSetLocale description: useSetLocale Hook 的 API 参考 --- {/* 自动生成:请勿直接编辑。请改为编辑 content/docs-templates/ 中的 template。 */} ## 概述 `useSetLocale` hook 用于设置用户的区域设置。 该 hook 仅支持客户端使用,且必须包裹在 [``](/docs/react-native/api/components/gtprovider) 组件中。 ## 参考 ### 返回值 用于设置用户区域设置的函数。 *** ## 示例 ### 基本用法 ```jsx import { useSetLocale } from 'gt-react-native'; export default function MyComponent() { const setLocale = useSetLocale(); return ; } ``` *** ## 注意事项 * `useSetLocale` 用于设置用户的区域设置。 * 在[此处](/docs/core/locales)了解更多有关区域设置代码的信息。 ## 后续步骤 * 详细了解 [``](/docs/react-native/api/components/gtprovider) 组件。 * 详细了解 [`useLocale`](/docs/react-native/api/helpers/use-locale) Hook。