react Intl - How to return a plain translated string instead of return JSX Element(FormattedMessage). #2635
Answered
by
longlho
yuteen-nikhare-ui
asked this question in
Q&A
-
We can use FormattedMessage to get component with translated text. Instead of getting component with translated text, I need a plain translated string. I want something like this: getTranslatedText(id: string): string { it will return a string instead of JSX (COMPONENT) } |
Beta Was this translation helpful? Give feedback.
Answered by
longlho
Feb 23, 2021
Replies: 2 comments 7 replies
-
You can use intl.formatMessage and the way you get a reference to the |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
longlho
-
Most needed function!! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use intl.formatMessage and the way you get a reference to the
intl
object is via useIntl or injectIntl HOC.