From e7cb782d7962b78638c3ff88ad306fb4a592d3ec Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 27 Jan 2022 08:25:34 -0500 Subject: [PATCH] resolve PR comments Signed-off-by: Sebastian Malton --- src/renderer/components/icon/icon.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/icon/icon.tsx b/src/renderer/components/icon/icon.tsx index 3bfa616c59..a0c3551434 100644 --- a/src/renderer/components/icon/icon.tsx +++ b/src/renderer/components/icon/icon.tsx @@ -5,7 +5,7 @@ import "./icon.scss"; -import React, { ReactNode } from "react"; +import React, { createRef, ReactNode } from "react"; import { NavLink } from "react-router-dom"; import type { LocationDescriptor } from "history"; import { boundMethod, cssNames } from "../../utils"; @@ -30,7 +30,7 @@ export interface IconProps extends React.HTMLAttributes, TooltipDecoratorPr @withTooltip export class Icon extends React.PureComponent { - public ref?: HTMLElement; + private readonly ref = createRef(); static defaultProps: IconProps = { focusable: true, @@ -60,7 +60,7 @@ export class Icon extends React.PureComponent { // fallthrough case "Enter": { - setImmediate(() => this.ref?.click()); + this.ref.current?.click(); evt.preventDefault(); break; } @@ -121,16 +121,16 @@ export class Icon extends React.PureComponent { const { className, children } = iconProps; return ( - this.ref = e}> + {children} ); } if (href) { - return this.ref = e}/>; + return ; } - return this.ref = e} />; + return ; } }