Passing the returned function from useTranslations
to other functions
#830
Unanswered
janoschherrmann
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there,
I have a case where I want to access a certain subset of my translations in a component, which I then want to pass to another function. The reason for this is that otherwise, I would have a lot of markup inside my component (it's a big
Footer
) and I'd rather separate the "markup generation" from the component.The problem is that the TypeScript type doesn't seem to accurate, as it doesn't take into account the
path.to.my.translations
, which means the autocomplete breaks. Another thing is that I would now have to define the functiongetMessages
inside the component, as otherwise the TS type wouldn't be in scope.Is there a way around this?
Beta Was this translation helpful? Give feedback.
All reactions