import React, { Component } from "react"; class ErrorBoundary extends Component { constructor(props) { super(props); this.state = { hasError: false }; } componentDidCatch(error, info) { this.setState({ hasError: true }); // log the error to an error reporting service // logErrorToMyService(error, info); // if(process.env.NODE_ENV === 'production') DataService.postToSlack( // `${window.location.href}: ${error.message}`, // info.componentStack // ); console.log(error, info); } render() { if (this.state.hasError) { return (