Skip to content

Commit 796ca41

Browse files
authored
fix(GoBackButton): fixes type issue (#12)
2 parents 332afd7 + cc04eba commit 796ca41

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

react-kit/src/lib/components/buttons/GoBackButton.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import React from 'react';
22
import { IconButton, Tooltip } from '@mui/material';
33
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
4+
import { useNavigate } from 'react-router-dom';
45

56
interface GoBackButtonProps {
6-
onClick: () => void;
77
name?: string;
88
children?: React.ReactNode;
99
}
1010

1111
export function GoBackButton(props: GoBackButtonProps) {
12+
const navigate = useNavigate();
1213
return (
1314
<Tooltip title="Go Back to Previous Page">
14-
<IconButton name={props.name} color="primary" onClick={() => props.onClick()}>
15+
<IconButton name={props.name} color="primary" onClick={() => navigate(-1)}>
1516
<ArrowBackIosIcon />
16-
{props.children ?? props.name}
17+
{props.children}
1718
</IconButton>
1819
</Tooltip>
1920
);

0 commit comments

Comments
 (0)