Skip to content

Commit

Permalink
cpumeter: fixed forwardref error log
Browse files Browse the repository at this point in the history
  • Loading branch information
fde31 committed Dec 10, 2024
1 parent f934cbd commit ef57dd6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/components/header/cpu.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { FunctionComponent, memo } from "react";
import { forwardRef, FunctionComponent, memo } from "react";
import classes from "./cpu.module.css";

export type CPUStatusProps = {
load: number;
};

export const CPUStatus: FunctionComponent<CPUStatusProps> = memo(function WrappedCPUStatusComponent({
load
}) {
return (
<div className={ classes.cpuRoot } >
<div className={ classes.cpuBar } style={{ width: `${load}%`}} />
<label className={ classes.cpuLabel } >
{ `${Math.round(load)}%` }
</label>
</div>
);
});
export const CPUStatus: FunctionComponent<CPUStatusProps> = memo(forwardRef<HTMLDivElement, CPUStatusProps>(
function WrappedCPUStatusComponent({ load }, ref) {
return (
<div className={ classes.cpuRoot } ref={ ref } >
<div className={ classes.cpuBar } style={{ width: `${load}%`}} />
<label className={ classes.cpuLabel } >
{ `${Math.round(load)}%` }
</label>
</div>
);
}
));

0 comments on commit ef57dd6

Please sign in to comment.