import { MutableRefObject , createContext } from 'react' ; export class TabItemRefs { public items : MutableRefObject < HTMLElement | null > [ ] = [ ] ; public register ( ref ) { this . items . push ( ref ) ; return this . items . length - 1 ; } public unregister ( ref ) { this . items . splice ( this . items . indexOf ( ref ) , 1 ) ; } } interface TabsState { refs ? : TabItemRefs ; } const initialValue = { } ; export const TabsContext = createContext < TabsState > ( initialValue ) ;