I search through articles and went through many stack overflow questions but I am still resolving the issue.
In react router dom v5, it is easier to pass data through state object as shown in the link answers: React-router - How to pass data between pages in React?
In react-router-dom v5:
<Link to={{
pathname: '/show',
state: {id: 1, name: 'sabaoon', shirt: 'green'}
}} >
View Details</Link>
the state should be received in another page via this.props.location.state.id etc.
but now in v6 the same method is not passing state object to the location of another page.
When I tried to console log the this.props.location on another page to which I am passing data it is giving me 'undefined' on console.
How we can do the same thing with v6.
Note: I want to do it in class component of react not in function component and I don't want to share it through params as well.