import React from 'react'; import MessageBox from '@/components/MessageBox'; import { useStoreState } from 'easy-peasy'; import tw from 'twin.macro'; type Props = Readonly<{ byKey?: string; className?: string; }>; const FlashMessageRender = ({ byKey, className }: Props) => { const flashes = useStoreState((state) => state.flashes.items.filter((flash) => (byKey ? flash.key === byKey : true)) ); return flashes.length ? (
{flashes.map((flash, index) => ( {index > 0 &&
} {flash.message}
))}
) : null; }; export default FlashMessageRender;