How to cancel fetch when the screen unmounts?

I'm having a bit of an issue with asynchronous fetch operation. Fetch operation starts on componentWillMount() and if causes issue if the user navigates back before a response is generated.

I need a workaround to not update state with data response if the user has already unmounted the screen. i.e., cancel fetch when the screen unmounts.

No Comments Yet