MCPcopy Create free account
hub / github.com/Seanium/ChatMap / useToast

Function useToast

hooks/use-toast.ts:169–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

167}
168
169function useToast() {
170 const [state, setState] = React.useState<State>(memoryState)
171
172 React.useEffect(() => {
173 listeners.push(setState)
174 return () => {
175 const index = listeners.indexOf(setState)
176 if (index > -1) {
177 listeners.splice(index, 1)
178 }
179 }
180 }, [state])
181
182 return {
183 ...state,
184 toast,
185 dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
186 }
187}
188
189export { useToast, toast }

Callers

nothing calls this directly

Calls 1

dispatchFunction · 0.70

Tested by

no test coverage detected