Skip to content
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

Added WrappedComponent property to translate wrapper #15

Merged
merged 1 commit into from
Feb 24, 2016

Conversation

tkislan
Copy link
Contributor

@tkislan tkislan commented Feb 24, 2016

When you wrap component in translate, you loose any reference to it.
This is for example required when you're doing server-side rendering, and Component defines which actions to do to prefetch data.

Same approach is used in react-redux connect wrapper

@tkislan
Copy link
Contributor Author

tkislan commented Feb 24, 2016

import { translate } from 'react-i18next/lib';

export default function translateMixin(translations) {
  return (WrappedComponent) => {
    const componentFunc = translate(translations)(WrappedComponent);
    componentFunc['WrappedComponent'] = WrappedComponent;
    return componentFunc;
  }
}

This is what I have to do as a workaround

jamuhl added a commit that referenced this pull request Feb 24, 2016
Added WrappedComponent property to translate wrapper
@jamuhl jamuhl merged commit fe2ed9d into i18next:master Feb 24, 2016
@jamuhl
Copy link
Member

jamuhl commented Feb 24, 2016

just published v1.1.0

@jamuhl
Copy link
Member

jamuhl commented Feb 24, 2016

thank you for the contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants