Can I use componentWillUnmount to send 'PUT' request?

I am storing some data in my state object that I’m using and manipulating in my component. But when the user is done and exits the component, I want to update my database with the data in state. Is it OK to do this in componentWillUnmount? or atleast call an event handler ? Or is their a better way?
Thanks for the advice!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.