Is there a method exist that will run before the page is refreshed, such as componentWillUnmount?

I am making a website and struggling to find the function, that will send a request to a server before a user refreshes the webpage. Is there any way to accomplish this work?