Problem: Currently app is redirecting user from PageA to ErrorPage if some data is not found on PageA using react-router redirect. Now when the user is on ErrorPage and clicks on the browser back button. IT DOES NOT take back to PageA Here is a code example ` //PageA - this component is inside BrowserRouter
import React from 'react'
const PageA = () = {
const data = null
return (
data ? (<PageAComponent />) : (
<Redirect
to={{
pathname: "/errorPage",
state: { referrer: 'PageA' }
}}
/>
)
)
}
//ErrorPage
import React from 'react'
const ErrorPage = () = {
return (
<>.....something is displayed.....</>)
)
}