2018-07-23 22:43:57 +00:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import { FormattedMessage, FormattedNumber, defineMessages } from 'react-intl'
|
2017-02-24 21:45:18 +00:00
|
|
|
import Head from 'next/head'
|
|
|
|
import Layout from '../components/Layout'
|
2018-07-23 22:43:57 +00:00
|
|
|
import withIntl from '../lib/withIntl'
|
2017-02-24 21:45:18 +00:00
|
|
|
|
2018-07-23 22:43:57 +00:00
|
|
|
const { description } = defineMessages({
|
2017-02-24 21:45:18 +00:00
|
|
|
description: {
|
|
|
|
id: 'description',
|
|
|
|
defaultMessage: 'An example app integrating React Intl with Next.js'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2018-07-23 22:43:57 +00:00
|
|
|
class Index extends Component {
|
|
|
|
static getInitialProps () {
|
|
|
|
// Do something
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { intl } = this.props
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Layout>
|
|
|
|
<Head>
|
|
|
|
<meta name='description' content={intl.formatMessage(description)} />
|
|
|
|
</Head>
|
|
|
|
<p>
|
|
|
|
<FormattedMessage id='greeting' defaultMessage='Hello, World!' />
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<FormattedNumber value={1000} />
|
|
|
|
</p>
|
|
|
|
</Layout>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withIntl(Index)
|