Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update form handler example (#11059)
- Loading branch information
Showing
5 changed files
with
40 additions
and
93 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.