Use useCallback

Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
David Baker 2022-11-23 10:06:14 +00:00 committed by GitHub
parent 098be75415
commit 40a0958e0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,9 +82,9 @@ function Option<T>({ item, state, className }: OptionProps<T>) {
// https://github.com/vector-im/element-call/issues/762 // https://github.com/vector-im/element-call/issues/762
const origPointerUp = optionProps.onPointerUp; const origPointerUp = optionProps.onPointerUp;
delete optionProps.onPointerUp; delete optionProps.onPointerUp;
optionProps.onClick = (e) => { optionProps.onClick = useCallback((e) => {
origPointerUp(e as unknown as React.PointerEvent<HTMLElement>); origPointerUp(e as unknown as React.PointerEvent<HTMLElement>);
}; }, [origPointerUp]);
return ( return (
<li <li