back button react router dom code example
Example: react router native back button
<BackButton />
Connects the global back button on Android and tvOS to the router’s history. On Android, when the initial location is reached, the default back behavior takes over. Just render one somewhere in your app.