Skip to content

Commit

Permalink
Updates Error 404 component so that we can set 404 status on SSR rend…
Browse files Browse the repository at this point in the history
…ers (mui#357)
  • Loading branch information
diondirza authored and ctrlplusb committed Feb 19, 2017
1 parent e3b99f6 commit e8f027e
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions shared/components/DemoApp/Error404/Error404.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import React from 'react';
import React, { Component, PropTypes } from 'react';

function Error404() {
return (
<div>Sorry, that page was not found.</div>
);
class Error404 extends Component {
componentWillMount() {
const { staticContext } = this.context.router;
if (staticContext) {
staticContext.missed = true;
}
}

render() {
return (
<div>
<div>Sorry, that page was not found.</div>
</div>
);
}
}

Error404.contextTypes = {
router: PropTypes.shape({
staticContext: PropTypes.object,
}).isRequired,
};

export default Error404;

0 comments on commit e8f027e

Please sign in to comment.