@shopify/polaris
Version:
Shopify’s product component library
31 lines (27 loc) • 922 B
JavaScript
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.
var Toast = /*#__PURE__*/memo(function Toast(props) {
var id = useUniqueId('Toast');
var {
showToast,
hideToast
} = useFrame();
useDeepEffect$1(() => {
showToast(_objectSpread2({
id
}, props));
return () => {
hideToast({
id
});
}; // eslint-disable-next-line react-hooks/exhaustive-deps
}, [props]);
return null;
});
export { Toast };