Open c089 opened 8 years ago
I'm facing the same issue in a project of mine. My current best idea would be to have different routes module on the client, that filters the 404 route. Pseudocode:
//server/routes.js
import routes from '../app/routes';
export default routes.filter(r => r.status !== 400);
Any better ideas?
Turns out we can use renderProps.route
to search for a 404 route:
// given a route defined like this:
<Route status={404}/>
// in the match callback we can:
const is404 = renderProps.routes.find(r => r.status === 404) !== undefined;
+1
+1
How to pass status for ex for this route: /collection/:id_product ???
Because of the catch-all route
match
will always match a route andrenderProps
will always be defined. For this reason, this branch is never reached and the 404 page is served with a status code of 200.