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

Add getWrappedInstance() to translate wrapper #82

Merged
merged 2 commits into from
Apr 29, 2016
Merged

Add getWrappedInstance() to translate wrapper #82

merged 2 commits into from
Apr 29, 2016

Conversation

vpriem
Copy link
Contributor

@vpriem vpriem commented Apr 28, 2016

Sometimes you need to access to the component instance wrapped in the component returned by translate().

No magic, just copied the approach of react-redux connect.

@jamuhl
Copy link
Member

jamuhl commented Apr 28, 2016

@vpriem
Copy link
Contributor Author

vpriem commented Apr 29, 2016

As far as i understand Translate.WrappedComponent is more to access to the component, for server side rendering as described in pull request #15, but not to the rendered instance itself. With getWrappedInstance() you could access to the instance using ref. Should I provide an example?

@jamuhl
Copy link
Member

jamuhl commented Apr 29, 2016

ok i see. can you remove the dependency on invariant? prefer to keep dependencies low.

@jamuhl
Copy link
Member

jamuhl commented Apr 29, 2016

will be merged afterwards...

@vpriem
Copy link
Contributor Author

vpriem commented Apr 29, 2016

I was thinking of that. Of course I can but should I remove invariant completely, throwing an exception if { withRef: true } was not provided? Or should I add invariant as external to the rollup config and let developers manage the dependency by themselves?

@jamuhl
Copy link
Member

jamuhl commented Apr 29, 2016

i would prefer removing it completely...console.error might be good enough?

@vpriem
Copy link
Contributor Author

vpriem commented Apr 29, 2016

As you want, just removed all invariant deps and added console.error.

@jamuhl jamuhl merged commit 369e4ff into i18next:master Apr 29, 2016
@jamuhl
Copy link
Member

jamuhl commented Apr 29, 2016

published [email protected]

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