In Reactjs, I am writing a function component which includes a button looks like this:
<button onClick = {() =>history.goBack()}>
Go Back
</button>
I need to ensure that when clicking on the button, only go back when the previous page is within the app, how can I achieve that?
Thanks so much for any help!