import { Ref , useEffect , useRef } from 'react' ; import { TabsActions } from '@material-ui/core' ; const useTabAction = ( ) : Ref < TabsActions > => { const ref = useRef < TabsActions > ( null ) ; useEffect ( ( ) => { const listener = ( ) => { ref . current ?. updateIndicator ( ) ; ref . current ?. updateScrollButtons ( ) ; } ; window . addEventListener ( 'load' , listener ) ; return ( ) => window . removeEventListener ( 'load' , listener ) ; } , [ ] ) ; return ref ; } ; export default useTabAction ;