I don't have the reputation to comment on an answer, this is an
addition to akhtarvahid's answer.
Here is some information you might find useful automatically give these values in props, to use the Route functionalities :
<Route path="/about" component={About} />
Cannot read properties of undefined (reading 'push')
{match: Object, location: Object, history: Object,
staticContext:undefined}
The examples above only work if you don't want to add any other value in props.
if we pass our component to Route as a child, the rendering is done correctly and the route works.
<Route exact path="/" > <Home name="toto" /></Route>
But in this case Route will not pass the props to our component so we will not have histoy, location ect...
{name: "foo"}
if you use
this.props.history.push("/about");
this will generate an error because history was not added to the component
Cannot read properties of undefined (reading 'push')
Here is a solution that allows the Route component with a callback
<Exact route path="/"
render={(props) =><Home name="foo" {...props}/>}
></Road>
{name:"foo", match: Object, location: Object, history: Object,
staticContext:undefined}