Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
...props
},
ref,
) => {
bsPrefix = useBootstrapPrefix('toast');
const delayRef = useRef(delay);
const onCloseRef = useRef(onClose);
useEffect(() => {
// We use refs for these, because we don't want to restart the autohide
// timer in case these values change.
delayRef.current = delay;
onCloseRef.current = onClose;
}, [delay, onClose]);
const autohideTimeout = useTimeout();
const autohideFunc = useCallback(() => {
if (!(autohide && show)) {
return;
}
onCloseRef.current();
}, [autohide, show]);
autohideTimeout.set(autohideFunc, delayRef.current);
const useAnimation = useMemo(() => Transition && animation, [
Transition,
animation,
]);
const toast = (