removed onError from state

This commit is contained in:
Sebastian Qvarfordt
2020-03-31 13:21:26 +02:00
parent 924a999079
commit 4e9151ba3c
@@ -18,12 +18,12 @@ import React, { ComponentClass, Component, SFC } from 'react';
type Props = {
slackChannel: string;
onError?: (error: Error, errorInfo: string) => null;
};
type State = {
error?: Error;
errorInfo?: string;
onError?: (error: Error, errorInfo: string) => null;
};
const ErrorBoundary: ComponentClass<
@@ -36,7 +36,6 @@ const ErrorBoundary: ComponentClass<
this.state = {
error: undefined,
errorInfo: undefined,
onError: props.onError,
};
}
@@ -46,8 +45,8 @@ const ErrorBoundary: ComponentClass<
this.setState({ error, errorInfo });
// Exposed for testing
if (this.state.onError) {
this.state.onError(error, errorInfo);
if (this.props.onError) {
this.props.onError(error, errorInfo);
}
}