import useState from './useState' ; interface IRef < T > { current : T | undefined ; ( val ) : void ; } export default function useRef < T > ( ) { const ref = ( val ) => { ref . current = val ; } ; ref . current = undefined ; return useState < IRef < T > > ( ref ) ; }