mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Update with-kea example (#5259)
- updates transform-decorators-legacy - updates with-next-redux-wrapper
This commit is contained in:
parent
dc3be63ad2
commit
60b1d26f1f
|
@ -3,6 +3,6 @@
|
||||||
"next/babel"
|
"next/babel"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"transform-decorators-legacy"
|
["@babel/plugin-proposal-decorators", { "legacy": true }]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,18 @@
|
||||||
"start": "next start"
|
"start": "next start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"kea": "^0.27.3",
|
"kea": "^0.28.4",
|
||||||
"next": "latest",
|
"next": "latest",
|
||||||
"next-redux-wrapper": "^1.3.4",
|
"next-redux-wrapper": "^2.0.0",
|
||||||
"prop-types": "^15.6.0",
|
"prop-types": "^15.6.0",
|
||||||
"react": "^16.1.0",
|
"react": "^16.1.0",
|
||||||
"react-dom": "^16.1.0",
|
"react-dom": "^16.1.0",
|
||||||
"react-redux": "^5.0.6",
|
"react-redux": "^5.0.6",
|
||||||
"redux": "^3.7.2",
|
"redux": "^4.0.0",
|
||||||
"reselect": "^3.0.1"
|
"reselect": "^3.0.1"
|
||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-plugin-transform-decorators-legacy": "^1.3.4"
|
"@babel/plugin-proposal-decorators": "^7.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
24
examples/with-kea/pages/_app.js
Normal file
24
examples/with-kea/pages/_app.js
Normal file
|
@ -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 (
|
||||||
|
<Container>
|
||||||
|
<Provider store={store}>
|
||||||
|
<Component {...pageProps} />
|
||||||
|
</Provider>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { initStore } from '../store'
|
|
||||||
import withRedux from 'next-redux-wrapper'
|
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { kea } from 'kea'
|
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 () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -39,5 +38,3 @@ class App extends React.Component {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withRedux(initStore)(App)
|
|
||||||
|
|
Loading…
Reference in a new issue