Skip to content

Commit ba2fbc2

Browse files
authoredAug 30, 2020
Update _app.js to use a function component. (#16683)
This PR updates the `_app.js` file to remove the `next/app` import. It's not needed with the latest versions of Next
1 parent 6926ab7 commit ba2fbc2

File tree

1 file changed

+6
-10
lines changed
  • examples/with-styled-components/pages

1 file changed

+6
-10
lines changed
 
+6-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import App from 'next/app'
21
import { ThemeProvider } from 'styled-components'
32

43
const theme = {
@@ -7,13 +6,10 @@ const theme = {
76
},
87
}
98

10-
export default class MyApp extends App {
11-
render() {
12-
const { Component, pageProps } = this.props
13-
return (
14-
<ThemeProvider theme={theme}>
15-
<Component {...pageProps} />
16-
</ThemeProvider>
17-
)
18-
}
9+
export default function App({ Component, pageProps }) {
10+
return (
11+
<ThemeProvider theme={theme}>
12+
<Component {...pageProps} />
13+
</ThemeProvider>
14+
)
1915
}

0 commit comments

Comments
 (0)
Please sign in to comment.