diff --git a/public/app/core/components/ErrorBoundary/ErrorBoundary.tsx b/public/app/core/components/ErrorBoundary/ErrorBoundary.tsx index ed068819adc..188750b0fef 100644 --- a/public/app/core/components/ErrorBoundary/ErrorBoundary.tsx +++ b/public/app/core/components/ErrorBoundary/ErrorBoundary.tsx @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import { Component } from 'react'; interface ErrorInfo { componentStack: string; @@ -19,10 +19,10 @@ interface State { } class ErrorBoundary extends Component { - constructor(props) { - super(props); - this.state = { error: null, errorInfo: null }; - } + readonly state: State = { + error: null, + errorInfo: null, + }; componentDidCatch(error: Error, errorInfo: ErrorInfo) { this.setState({ @@ -32,15 +32,12 @@ class ErrorBoundary extends Component { } render() { + const { children } = this.props; const { error, errorInfo } = this.state; - return ( - <> - {this.props.children({ - error, - errorInfo, - })} - - ); + return children({ + error, + errorInfo, + }); } } diff --git a/public/app/plugins/panel/graph2/GraphPanel.tsx b/public/app/plugins/panel/graph2/GraphPanel.tsx index 2c21c7f0e15..020c33f7d38 100644 --- a/public/app/plugins/panel/graph2/GraphPanel.tsx +++ b/public/app/plugins/panel/graph2/GraphPanel.tsx @@ -10,10 +10,6 @@ import { Options } from './types'; interface Props extends PanelProps {} export class GraphPanel extends PureComponent { - constructor(props: Props) { - super(props); - } - render() { const { timeSeries, timeRange, width, height } = this.props; const { showLines, showBars, showPoints } = this.props.options;