-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A better 'Something went wrong.' view #12
Comments
Hello, |
Thank you :) |
Hi LeonardoGentile , thank you . PR has been raised . #13 |
My Armenian friend did something like this: import {RouteView as BaseRouteView} from "react-mobx-router5";
class ErrorComponent extends React.Component {
render() {
return (
<div>
My custom component error. Syskius!
</div>
)
}
}
class RouteView extends BaseRouteView {
render() {
if (this.state.hasError) {
return <this.props.errorComponent {...this.props}/>;
}
return super.render();
}
}
class Channels extends React.Component {
render() {
const {route} = this.props;
return (
<RouteView
errorComponent={ErrorComponent}
route={route}
routes={routesMap}
routeNodeName={routeNodeName}
/>
)
}
} |
My Armenian friend decided to go further: redefine render method of RouteView (in import * as Rmr from "react-mobx-router5";
class ErrorComponent extends React.Component {
render() {
return (
<div>
My custom component error. Syskius!
</div>
)
}
}
const oldRender = Rmr.RouteView.prototype.render;
Rmr.RouteView.prototype.render = function () {
if (this.state.hasError) {
return <ErrorComponent {...this.props}/>;
}
return oldRender.apply(this);
}; |
Hi, I saw the PR got merged, is there a release version for this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi.
I have a requirement to replace the 'Something went wrong' message with a nicer looking view which is much more complex than a simple string.
How would I go about doing this ?
Should I raise a PR for this change ?
Or should I be forking this project and maintaining my own version ?
The text was updated successfully, but these errors were encountered: