-
-
Save giautm/d971c227e788396e254d4b78447e3249 to your computer and use it in GitHub Desktop.
Bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Link from 'next/link'; | |
import { translate } from 'react-i18next'; | |
import i18n from '../i18n'; | |
import Frontend from '../components/frontend/Frontend/Frontend'; | |
class Home extends React.Component { | |
render() { | |
return ( | |
<Frontend> | |
{this.props.t('welcome')} | |
</Frontend> | |
); | |
} | |
} | |
const Extended = translate(['home', 'common'], { | |
i18n, | |
wait: process.browser, | |
})(Home); | |
// Passing down initial translations | |
// use req.i18n instance on serverside to avoid overlapping requests set the language wrong | |
Extended.getInitialProps = async ({ req }) => { | |
if (req && !process.browser) return i18n.getInitialProps(req, ['home', 'common']); | |
return {}; | |
}; | |
export default Extended; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment