Could help me please to type history.goBack in React? At the moment I use type any but I think its a wrong way.
Main.tsx
...
<Route path={PAGE_404} component={Page404} />
Page404.tsx
const Page404: React.FC<RouteComponentProps> = ({ history }) => {
return (
<section className={styles.section}>
<GoBackLink text={'Назад'} onGoBackClick={() => history.goBack()} />
...
</div>
</section>
);
};
export default Page404;
GoBackLink.tsx with interface and type any for onGoBackClick key
interface IGoBackLinkProps {
text: string;
onGoBackClick: any;
}
const GoBackLink: React.FC<IGoBackLinkProps> = ({ text, onGoBackClick }) => {
return (
<Link className={styles.link} to='/' onClick={onGoBackClick}>
{text}
</Link>
);
};
export default GoBackLink;