Would adding all namespaces to useTranslation decrease performance on page-level? #1708
-
Hi, On page level I have the serverSideTranslations with my specific namespaces. Problem is that I can't use the custom Text component with useTranslation without defining the specific namespace. So my question is: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Yes, it would negatively affect performance. Each namespace you specify gets passed as props into the page-level component, via either The concept of namespaces is specifically to chunk out translation data to prevent the issue you are describing. |
Beta Was this translation helpful? Give feedback.
-
Alright, thank you very much for your answer. That's unfortunately what I expected.. So in short, there is no good way to go around only initializing useTranslation once and just reuse that through props if there's multiple namespaces? I need to add useTranslation to all pages and components? Or am I not seeing something.. |
Beta Was this translation helpful? Give feedback.
Yes, it would negatively affect performance. Each namespace you specify gets passed as props into the page-level component, via either
getStaticProps
orgetServerSideProps
.The concept of namespaces is specifically to chunk out translation data to prevent the issue you are describing.