mirror of https://github.com/sylv/micro.git
14 lines
404 B
TypeScript
14 lines
404 B
TypeScript
import { useContext } from 'react';
|
|
import { ToastContext } from '../components/toast/toast-wrapper';
|
|
|
|
export const useToasts = () => {
|
|
const createToast = useContext(ToastContext);
|
|
if (!createToast) {
|
|
// todo: this should be an error, but it seems like it can be undefined.
|
|
// maybe due to concurrent rendering? idk shit about fuck.
|
|
return () => undefined;
|
|
}
|
|
|
|
return createToast;
|
|
};
|