import * as React from "react" ; example export const useConditionalAnimation = ( defaultClass , animation , condition ) => { const entranceAnimation = React . useRef ( defaultClass ) ; React . useEffect ( ( ) => { if ( condition ) { entranceAnimation . current = animation ; } } , [ condition , animation ] ) ; return entranceAnimation . current ; } ;