mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
27 lines
538 B
JavaScript
27 lines
538 B
JavaScript
|
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
|