Created
May 28, 2016 17:48
-
-
Save davidascher/0ace77b39ab183449420f11d52012196 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * NotFoundPage | |
| * | |
| * This is the page we show when the user visits a url that doesn't have a route | |
| */ | |
| import React from 'react'; | |
| import { connect } from 'react-redux'; | |
| import { push } from 'react-router-redux'; | |
| import Button from 'components/Button'; | |
| import H1 from 'components/H1'; | |
| export function NotFound(props) { | |
| return ( | |
| <article> | |
| <H1>Page not found.</H1> | |
| <Button | |
| handleRoute={function redirect() { | |
| props.changeRoute('/'); | |
| }} | |
| > | |
| Home | |
| </Button> | |
| </article> | |
| ); | |
| } | |
| NotFound.propTypes = { | |
| changeRoute: React.PropTypes.func, | |
| }; | |
| // react-redux stuff | |
| function mapDispatchToProps(dispatch) { | |
| return { | |
| changeRoute: (url) => dispatch(push(url)), | |
| }; | |
| } | |
| // Wrap the component to inject dispatch and state into it | |
| export default connect(null, mapDispatchToProps)(NotFound); |
gaearon
commented
May 28, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment