Skip to content

Commit

Permalink
Convert _app.js to functional components
Browse files Browse the repository at this point in the history
  • Loading branch information
stramel committed Jan 15, 2020
1 parent 57ec121 commit cfa98a5
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions examples/with-app-layout/pages/_app.js
@@ -1,20 +1,11 @@
import React from 'react'
import App from 'next/app'

class Layout extends React.Component {
render() {
const { children } = this.props
return <div className="layout">{children}</div>
}
}
const Layout = ({ children }) => (
<div className="layout">{children}</div>
)

export default class MyApp extends App {
render() {
const { Component, pageProps } = this.props
return (
<Layout>
<Component {...pageProps} />
</Layout>
)
}
}
export default ({ Component, pageProps }) => (
<Layout>
<Component {...pageProps} />
</Layout>
)

0 comments on commit cfa98a5

Please sign in to comment.