File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
react-kit/src/lib/components/buttons Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { IconButton , Tooltip } from '@mui/material' ;
33import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos' ;
4+ import { useNavigate } from 'react-router-dom' ;
45
56interface GoBackButtonProps {
6- onClick : ( ) => void ;
77 name ?: string ;
88 children ?: React . ReactNode ;
99}
1010
1111export 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 ) ;
You can’t perform that action at this time.
0 commit comments