I would like to render the UI differently depending on where we arrive at the current page. For example, an item detail page should have an extra 'delete' button if we come from '/mycollection' versus '/apiSearchResults'. How do I achieve this in react router v6?
I know I can create an Higher order component that encapsulates the reused component and the extra feature. But I am wondering if I can do without an HOC.
Thanks!