Refactor components to remove forwardRef and simplify props handling
- Updated multiple components to remove the use of forwardRef, simplifying the props structure. - Adjusted imports and component definitions accordingly. - Ensured consistent handling of refs and props across various viewer components. - Improved readability and maintainability of the codebase.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useTheme } from "@mui/material";
|
||||
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
||||
import { useEffect, useImperativeHandle, useRef } from "react";
|
||||
|
||||
const maxPoint = 30;
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface TrafficRef {
|
||||
/**
|
||||
* draw the traffic graph
|
||||
*/
|
||||
export const TrafficGraph = forwardRef<TrafficRef>((props, ref) => {
|
||||
export const TrafficGraph = ({ ref, ...props }) => {
|
||||
const countRef = useRef(0);
|
||||
const styleRef = useRef(true);
|
||||
const listRef = useRef<TrafficData[]>(defaultList);
|
||||
@@ -196,4 +196,4 @@ export const TrafficGraph = forwardRef<TrafficRef>((props, ref) => {
|
||||
}, [palette]);
|
||||
|
||||
return <canvas ref={canvasRef} style={{ width: "100%", height: "100%" }} />;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user