diff --git a/examples/with-kea/.babelrc b/examples/with-kea/.babelrc index b61375a6..8a6b2992 100644 --- a/examples/with-kea/.babelrc +++ b/examples/with-kea/.babelrc @@ -3,6 +3,6 @@ "next/babel" ], "plugins": [ - "transform-decorators-legacy" + ["@babel/plugin-proposal-decorators", { "legacy": true }] ] } diff --git a/examples/with-kea/package.json b/examples/with-kea/package.json index 9d13ebb8..df457e6f 100644 --- a/examples/with-kea/package.json +++ b/examples/with-kea/package.json @@ -7,18 +7,18 @@ "start": "next start" }, "dependencies": { - "kea": "^0.27.3", + "kea": "^0.28.4", "next": "latest", - "next-redux-wrapper": "^1.3.4", + "next-redux-wrapper": "^2.0.0", "prop-types": "^15.6.0", "react": "^16.1.0", "react-dom": "^16.1.0", "react-redux": "^5.0.6", - "redux": "^3.7.2", + "redux": "^4.0.0", "reselect": "^3.0.1" }, "license": "ISC", "devDependencies": { - "babel-plugin-transform-decorators-legacy": "^1.3.4" + "@babel/plugin-proposal-decorators": "^7.1.0" } } diff --git a/examples/with-kea/pages/_app.js b/examples/with-kea/pages/_app.js new file mode 100644 index 00000000..8c87bd8e --- /dev/null +++ b/examples/with-kea/pages/_app.js @@ -0,0 +1,24 @@ +import React from 'react' +import { Provider } from 'react-redux' +import App, { Container } from 'next/app' +import withRedux from 'next-redux-wrapper' +import { initStore } from '../store' + +@withRedux(initStore, { debug: process.env.NODE_ENV === 'development' }) +export default class MyApp extends App { + static async getInitialProps ({Component, ctx}) { + const pageProps = Component.getInitialProps ? await Component.getInitialProps(ctx) : {} + return { pageProps } + } + + render () { + const { Component, pageProps, store } = this.props + return ( + + + + + + ) + } +} diff --git a/examples/with-kea/pages/index.js b/examples/with-kea/pages/index.js index a94aa741..336ac721 100644 --- a/examples/with-kea/pages/index.js +++ b/examples/with-kea/pages/index.js @@ -1,6 +1,4 @@ import React from 'react' -import { initStore } from '../store' -import withRedux from 'next-redux-wrapper' import PropTypes from 'prop-types' import { kea } from 'kea' @@ -28,7 +26,8 @@ import { kea } from 'kea' ] }) }) -class App extends React.Component { + +export default class App extends React.Component { render () { return (
@@ -39,5 +38,3 @@ class App extends React.Component { ) } } - -export default withRedux(initStore)(App)