Skip to content

Commit

Permalink
Forward ref
Browse files Browse the repository at this point in the history
  • Loading branch information
rmdort committed Jul 10, 2018
1 parent b3a6635 commit 6c857f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-redux-multilingual",
"version": "2.0.0",
"version": "2.0.1",
"description": "A simple multilingual translate component and HOC for react and redux",
"main": "lib/index.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/withTranslate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { TranslateConsumer } from './context'
* @return {Object}
*/
function withTranslate (WrappedComponent) {
return (props) => (
<TranslateConsumer>
{(translate) => <WrappedComponent {...props} translate={translate} />}
return React.forwardRef((props, ref) => (
<TranslateConsumer>
{(translate) => <WrappedComponent {...props} translate={translate} ref={ref} />}
</TranslateConsumer>
)
))
}

export default withTranslate

0 comments on commit 6c857f2

Please sign in to comment.