1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-higher-order-component/components/withApp.js

27 lines
538 B
JavaScript
Raw Normal View History

import React from 'react'
function withApp (Child) {
return class WrappedComponent extends React.Component {
static getInitialProps (context) {
return Child.getInitialProps(context)
}
render () {
return (
<div>
<header>
<h1>Header</h1>
</header>
<main>
<Child greeting='Hello From HOC' {...this.props} />
</main>
<footer>
<h1>Footer</h1>
</footer>
</div>
)
}
}
}
export default withApp