I am trying to add animation between react routers using "react": "^16.13.1", "react-router-dom": "^5.2.0", "react-transition-group": "^4.4.1". But an error occurs saying "TypeError: Cannot read property 'location' of undefined", How to solve it?
MainComponent.js
...
return (
<div>
<Header />
<TransitionGroup>
<CSSTransition key={this.pops.location.key} classNames="page" timeout={300}>
<Switch>
<Route path='/home' >{HomePage}</Route>
<Route exact path='/contactus' component={() => <Contact resetFeedbackForm={this.props.resetFeedbackForm}/>} />
<Route exact path='/menu' component={() => <Menu dishes={this.props.dishes} />} />
<Route path='/menu/:dishId' component={DishWithId} />
<Route exact path='/aboutus' component={() => <About leaders={this.props.leaders} />} />
<Redirect to="/home" />
</Switch>
</CSSTransition>
</TransitionGroup>
<Footer />
</div>
);
}
...
How to get the location key?