From cc0397b23e758c01a8cdfde360bd1a6762dc1331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 2 Aug 2023 12:06:20 +0200 Subject: [PATCH] frontend: adding ListComponent --- frontend/src/components/ListComponent.tsx | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 frontend/src/components/ListComponent.tsx diff --git a/frontend/src/components/ListComponent.tsx b/frontend/src/components/ListComponent.tsx new file mode 100644 index 0000000..91d0858 --- /dev/null +++ b/frontend/src/components/ListComponent.tsx @@ -0,0 +1,37 @@ +import React, { useEffect, useRef } from 'react'; +import { DocStringComponent } from './DocStringComponent'; +import { GenericComponent } from './GenericComponent'; + +interface ListComponentProps { + name: string; + parent_path?: string; + value: object[]; + docString: string; +} + +export const ListComponent = React.memo((props: ListComponentProps) => { + const renderCount = useRef(0); + + useEffect(() => { + renderCount.current++; + }); + + const { name, parent_path, value, docString } = props; + + return ( +
+

Render count: {renderCount.current}

+ + {value.map((item, index) => { + return ( + + ); + })} +
+ ); +});