Skip to content

Commit 3a48c35

Browse files
committed
move transformers inside the function component to avoid circular dep problems
1 parent 76bddad commit 3a48c35

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/components/Translation.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ type TranslationProps = {
1313
transform?: HtmrOptions["transform"]
1414
}
1515

16-
// Custom components mapping to be used by `htmr` when parsing the translation
17-
// text
18-
const defaultTransform = {
19-
a: TooltipLink,
20-
}
21-
2216
// Renders the translation string for the given translation key `id`. It
2317
// fallback to English if it doesn't find the given key in the current language
2418
const Translation = ({ id, options, transform = {} }: TranslationProps) => {
@@ -28,6 +22,12 @@ const Translation = ({ id, options, transform = {} }: TranslationProps) => {
2822
const { t } = useTranslation(requiredNamespaces)
2923
const translatedText = t(id, options)
3024

25+
// Custom components mapping to be used by `htmr` when parsing the translation
26+
// text
27+
const defaultTransform = {
28+
a: TooltipLink,
29+
}
30+
3131
// Use `htmr` to parse html content in the translation text
3232
return htmr(translatedText, {
3333
transform: { ...defaultTransform, ...transform },

0 commit comments

Comments
 (0)