bizcharts-plugin-slider
Version:
A datazoom slider plugin for BizCharts based g2-plugin-slider.
23 lines (19 loc) • 473 B
JSX
import React, { Component } from 'react';
export default class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
componentDidCatch(error, info) {
this.setState({ hasError: true });
}
unstable_handleError(error, info) {
this.setState({ hasError: true });
}
render() {
if (this.state.hasError) {
return <h1>Slider error.</h1>;
}
return this.props.children;
}
}