[React-Native]Run a code before close

amlan - Aug 2 '20 - - Dev Community

I want to run a code before a React-native app close. So when we close the app, before it closes, I want to run a JS code. Does anyone know a way to achieve that? I used useState clean up but doesnt seem to be firing when I close the app.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .