Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Prefer React forwardRef in functional components over *Ref #10345

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Iterate
  • Loading branch information
t3chguy committed Mar 9, 2023
commit 752fd65d5aa4b5635b2b09cc3868b6cd905075e6
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ export const IconizedContextMenuCheckbox: React.FC<ICheckboxProps> = ({
};

export const IconizedContextMenuOption = forwardRef<HTMLElement, IOptionProps>(
({ label, className, iconClassName, children, isDestructive, ...props }) => {
({ label, className, iconClassName, children, isDestructive, ...props }, ref) => {
return (
<MenuItem
{...props}
@@ -126,6 +126,7 @@ export const IconizedContextMenuOption = forwardRef<HTMLElement, IOptionProps>(
mx_IconizedContextMenu_itemDestructive: isDestructive,
})}
label={label}
ref={ref}
>
{iconClassName && <span className={classNames("mx_IconizedContextMenu_icon", iconClassName)} />}
<span className="mx_IconizedContextMenu_label">{label}</span>