-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PrevProps the same as current props #508
Comments
it is the same object (singleton) and not an immutable...it just try to look it up in the different possible locations (context, props, ...) what exactly is your issue - why you need that previous language? |
Thanks for quick response. I have a case where I need to do some async calls when language changed. So I'd have condition in the Although i18next has |
hm...then i would suggest we pass lng from translate to component as a prop...the i18n instance is based on i18next and can't be really changed therefor so adding it to the I18n render props which is used in translate hoc and from there add it to components props?!? |
I can work on PR, but I'm not sure what are you referring to. You're talking about pass as prop here? |
yes and also here: https://github.com/i18next/react-i18next/blob/master/src/I18n.js#L124 basically passing it from that I18n to the line you showed above... feel free to make a PR |
related to issue #508: react_i18n object property
Hi and thanks for awesome library.
I use react-i18next in my project and I've got an issue when I want to access
prevProps
withinComponentDidUpdate
for example. In this caselanguage
field in thei18n
object is the same asthis.props
. You can see it in this demo .I took a look in the core and found that inside
translate
HOC you mutatei18n
object.Is there any reason why it was implemented this way? I'd really like to have
prevProps
has correct valuesThe text was updated successfully, but these errors were encountered: