Skip to content

Commit

Permalink
update form handler example (#11059)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdohnal committed Mar 13, 2020
1 parent 31a6410 commit e6b4cdd
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 93 deletions.
37 changes: 0 additions & 37 deletions examples/form-handler/components/index.js

This file was deleted.

3 changes: 1 addition & 2 deletions examples/form-handler/package.json
Expand Up @@ -5,14 +5,13 @@
"main": "index.js",
"scripts": {
"start": "next start",
"dev": "node server.js",
"dev": "next",
"build": "next build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.16.4",
"next": "latest",
"next-redux-wrapper": "^2.1.0",
"react": "^16.8.4",
Expand Down
28 changes: 7 additions & 21 deletions examples/form-handler/pages/_app.js
@@ -1,28 +1,14 @@
import App from 'next/app'
import React from 'react'
import { Provider } from 'react-redux'
import withRedux from 'next-redux-wrapper'
import { initStore } from '../store'

class MyApp extends App {
static async getInitialProps({ Component, router, ctx }) {
let pageProps = {}

if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx)
}

return { pageProps }
}

render() {
const { Component, pageProps, store } = this.props
return (
<Provider store={store}>
<Component {...pageProps} />
</Provider>
)
}
const App = ({ Component, pageProps, store }) => {
return (
<Provider store={store}>
<Component {...pageProps} />
</Provider>
)
}

export default withRedux(initStore)(MyApp)
export default withRedux(initStore)(App)
36 changes: 32 additions & 4 deletions examples/form-handler/pages/index.js
@@ -1,13 +1,41 @@
import React, { Component } from 'react'
import Head from 'next/head'
import { Col, Row, Grid } from 'react-bootstrap'

import { connect } from 'react-redux'
import Header from '../components/Header'
import DisplayForm from '../components/DisplayForm'

import Main from '../components'
import UserForm from '../components/UserForm'
import Social from '../components/Social'

class Index extends Component {
render() {
return <Main />
return (
<div>
<Head>
<title>Form Handler</title>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"
/>
</Head>
<Grid>
<Header />
<DisplayForm />
<Row>
<Col lg={6}>
<UserForm />
</Col>
<Col lg={6}>
<Social />
</Col>
</Row>
</Grid>
</div>
)
}
}

export default connect()(Index)
export default Index
29 changes: 0 additions & 29 deletions examples/form-handler/server.js

This file was deleted.

0 comments on commit e6b4cdd

Please sign in to comment.