Avaiable props:
isCallingApi: boolean
watch: func
Import
import withApiCatch from '../hocs/withApiCatch';
class Example extends Component {
...
}
export default withApiCatch(Example)
Watching an api
componentDidMount() {
this.props.watch(() => fakeApiCall().then(res => {
this.setState({ data: res })
}))
}