module author Surmon <https://github.com/surmon-china>
  import { useRef , useEffect } from 'react' ; export function onMounted ( callback ) { useEffect ( ( ) => { callback ( ) ; } , [ ] ) ; } export function onUpdated ( callback ) { const isMounted = useRef ( false ) ; useEffect ( ( ) => { if ( isMounted . current ) { callback ( ) ; } else { isMounted . current = true ; } } ) ; } export function onBeforeUnmount ( callback ) { useEffect ( ( ) => { return ( ) => { callback ( ) ; } ; } , [ ] ) ; }