1 2 3 4 5 6 7 8
const catchError = function(fn) { return (...args) => fn(...args).catch(error => { this.setState({ error }); }); }; export default catchError;