Skip to content

Commit

Permalink
Correctly pass props down in with-lingui example HOC (#7445)
Browse files Browse the repository at this point in the history
* correctly pass props down in Lingui example HOC

The WithLang HOC provided as part of the with-lingui example does not pass props down to the wrapped component.
This means that the result of getInitialProps is not passed to the page component.
This commit passes all props which aren't specific to the HOC implementation down to the wrapped component.

* remove semicolon to satisfy lint rules
  • Loading branch information
mcwebb authored and timneutkens committed May 29, 2019
1 parent 5e2e978 commit 9ccbb1f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/with-lingui/components/withLang.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ export default (Component, defaultLang = 'en') =>
}

render () {
const { language, catalogs, ...restProps } = this.props

return (
<I18nProvider
language={this.props.language}
catalogs={this.props.catalogs}
language={language}
catalogs={catalogs}
>
<Component />
<Component {...restProps} />
</I18nProvider>
)
}
Expand Down

0 comments on commit 9ccbb1f

Please sign in to comment.