The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/hooks/usePreventPropagation.ts

10 lines
350 B

import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import type { MouseEvent } from 'react';
export const usePreventPropagation = (fn?: (e: MouseEvent) => void): ((e: MouseEvent) => void) => {
const preventClickPropagation = useMutableCallback((e): void => {
e.stopPropagation();
fn?.(e);
});
return preventClickPropagation;
};