Skip to content

Commit

Permalink
docs: fix types in useI18n hook (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
ambar authored Feb 26, 2024
1 parent 4291e18 commit 3d0d1d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/document/docs/en/fragments/useI18n.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The framework provides `useI18n` this hook to get the internationalized text, th
import { useI18n } from 'rspress/runtime';

const MyComponent = () => {
const { t } = useI18n();
const t = useI18n();

return <div>{t('getting-started')}</div>;
};
Expand All @@ -28,7 +28,7 @@ Then use it like this in the component:
import { useI18n } from 'rspress/runtime';

const MyComponent = () => {
const { t } = useI18n<keyof typeof import('i18n')>();
const t = useI18n<typeof import('i18n')>();

return <div>{t('getting-started')}</div>;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/document/docs/zh/fragments/useI18n.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { useI18n } from 'rspress/runtime';

const MyComponent = () => {
const { t } = useI18n();
const t = useI18n();

return <div>{t('getting-started')}</div>;
};
Expand All @@ -28,7 +28,7 @@ const MyComponent = () => {
import { useI18n } from 'rspress/runtime';

const MyComponent = () => {
const { t } = useI18n<keyof typeof import('i18n')>();
const t = useI18n<typeof import('i18n')>();

return <div>{t('getting-started')}</div>;
};
Expand Down

0 comments on commit 3d0d1d9

Please sign in to comment.