You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
For components used in the same file, I have to rename my classes, e.g. Foo becomes FooBase
Probably user error somewhere, but class components that already had props are giving me red squigglies when instantiated via JSX in VS Code after wrapping them in 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 using injectIntl was best practice.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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