Skip to content

Instantly share code, notes, and snippets.

View shauntir's full-sized avatar

Praval 'Shaun' Tirubeni shauntir

View GitHub Profile
@shauntir
shauntir / react-error-handler-blog.js
Created April 16, 2018 03:33
React error handler component using componentDidCatch
import React, { Component } from 'react';
class ErrorrHandler extends Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
componentDidCatch(error, info) {
this.setState({ hasError: true });