0

I am using the react-router package. I want to send an API request when the tab is being closed.How can i do that in react.

  • 2
    Does this answer your question? https://stackoverflow.com/questions/64966559/is-there-a-function-like-componentwillunmount-that-will-fire-before-the-page-i/64967211#64967211 – Drew Reese Apr 17 '21 at 05:35
  • I have used `unload` event listener and `navigator.sendBeacon()` method to solve this – Rakibul Islam Rafi Apr 18 '21 at 08:30

0 Answers0