Example of react-intl with class component #4286
Unanswered
jaredkrinke
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.
-
Is there an official example of using react-intl with class components?
The docs say:
But the section on injectIntl HOC only uses a functional component.
I'm attempting to migrate my class component-based app to use react-intl, and I'm able to get it working, but there were a couple of surprises:
Foo
becomesFooBase
injectIntl
-- I'm intentionally omitting the error details here because I'm fairly certain I'm just doing something dumb -- but I don't have a "known good" example to compare against (all the examples I see are for trivial components without other props, and I searched for "class" in the examples/ directory and found no hits)Explicitly passing
intl
as props works fine for me, but I had assumed usinginjectIntl
was best practice.Beta Was this translation helpful? Give feedback.
All reactions