import React, { Fragment } from 'react'; import { useTransition } from 'react-spring'; //trigger: boolean, Comp: any, custom: any const Zoom = function({ trigger, Comp, custom }: { trigger: boolean; Comp: React.FC; custom: object }) { const transition = useTransition(trigger, null, { from: { scale: 0 }, enter: { scale: 1 }, leave: { scale: 0 }, config: { tension: 2000, clamp: true, }, }); return ( {transition.map( ({ item, key, props }: any) => item && ( `scale(${s})`) }} /> ) )} ); }; Zoom.defaultProps = {}; export default Zoom;