MCPcopy Create free account
hub / github.com/Tailframes/react-components / setToast

Function setToast

components/toast.tsx:138–152  ·  view source on GitHub ↗
(props: ToastProps | null)

Source from the content-addressed store, hash-verified

136 const [visible, setVisible] = useState<boolean>(false);
137
138 const setToast = (props: ToastProps | null) => {
139 if (props === null) {
140 setVisible(false);
141 // setTimeout used for smooth transition
142 const timeout = setTimeout(() => {
143 setToastProps(props);
144 }, 500);
145
146 setToastTimeout(timeout);
147 } else {
148 clearTimeout(toastTimeout);
149 setToastProps({ id: Date.now().toString(), ...props });
150 setVisible(true);
151 }
152 };
153
154 const handleClose = () => {
155 setToast(null);

Callers 1

handleCloseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected