diff --git a/frontend/src/components/DictComponent.tsx b/frontend/src/components/DictComponent.tsx new file mode 100644 index 0000000..4be26c5 --- /dev/null +++ b/frontend/src/components/DictComponent.tsx @@ -0,0 +1,42 @@ +import React, { useEffect, useRef } from 'react'; +import { DocStringComponent } from './DocStringComponent'; +import { SerializedValue, GenericComponent } from './GenericComponent'; +import { LevelName } from './NotificationsComponent'; + +type DictComponentProps = { + value: Record; + docString: string; + isInstantUpdate: boolean; + addNotification: (message: string, levelname?: LevelName) => void; + id: string; +}; + +export const DictComponent = React.memo((props: DictComponentProps) => { + const { value, docString, isInstantUpdate, addNotification, id } = props; + + const renderCount = useRef(0); + const valueArray = Object.values(value); + + useEffect(() => { + renderCount.current++; + }, [props]); + + return ( +
+ {process.env.NODE_ENV === 'development' && ( +
Render count: {renderCount.current}
+ )} + + {valueArray.map((item) => { + return ( + + ); + })} +
+ ); +});