UNPKG

@shopify/polaris

Version:

Shopify’s product component library

31 lines (27 loc) 872 B
import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js'; import { memo } from 'react'; import { useUniqueId } from '../../utilities/unique-id/hooks.js'; import { useDeepEffect as useDeepEffect$1 } from '../../utilities/use-deep-effect.js'; import { useFrame } from '../../utilities/frame/hooks.js'; // that the interface defining the props is defined in this file, not imported // from elsewhere. This silly workaround ensures that the Props Explorer table // is generated correctly. const Toast = /*#__PURE__*/memo(function Toast(props) { const id = useUniqueId('Toast'); const { showToast, hideToast } = useFrame(); useDeepEffect$1(() => { showToast(_objectSpread2({ id }, props)); return () => { hideToast({ id }); }; }, [props]); return null; }); export { Toast };