My basic component includes the following code snippet:
import * as React from 'react';
import { withRouter, RouteComponentProps } from 'react-router-dom';
export interface Props { };
@withRouter
export default class Movies extends React.PureComponent<Props> {
goBack = () => {
this.props.history.goBack();
};
public render() {
return (
<div>
<button onClick={this.goBack}>Back</button>
</div>
);
}
}
When utilizing withRouter
, I expect specific props to be injected into my component. However, when trying to access this.props.history
, I encounter the issue shown below:
https://i.sstatic.net/Ue9eI.png
I am seeking guidance on the correct approach to utilize decorators while including type definitions.