MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / useToast

Function useToast

website/src/hooks/use-toast.ts:166–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 3

BundleGeneratorSectionFunction · 0.90
CookbookSectionFunction · 0.90
ToasterFunction · 0.90

Calls 2

dispatchFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected