import React, { useEffect, useRef } from 'react'; import { DocStringComponent } from './DocStringComponent'; import { Attribute, GenericComponent } from './GenericComponent'; import { getIdFromFullAccessPath } from '../utils/stringUtils'; import { LevelName } from './NotificationsComponent'; type ListComponentProps = { name: string; parentPath?: string; value: Attribute[]; docString: string; isInstantUpdate: boolean; addNotification: (message: string, levelname?: LevelName) => void; }; export const ListComponent = React.memo((props: ListComponentProps) => { const { name, parentPath, value, docString, isInstantUpdate, addNotification } = props; const renderCount = useRef(0); const fullAccessPath = [parentPath, name].filter((element) => element).join('.'); const id = getIdFromFullAccessPath(fullAccessPath); useEffect(() => { renderCount.current++; }, [props]); return (
{process.env.NODE_ENV === 'development' && (
Render count: {renderCount.current}
)} {value.map((item, index) => { return ( ); })}
); });