import React, { useEffect, useRef, useState } from 'react'; import { Card, Collapse, Image } from 'react-bootstrap'; import { DocStringComponent } from './DocStringComponent'; import { ChevronDown, ChevronRight } from 'react-bootstrap-icons'; interface ImageComponentProps { name: string; parentPath: string; value: string; readOnly: boolean; docString: string; format: string; addNotification: (message: string) => void; } export const ImageComponent = React.memo((props: ImageComponentProps) => { const { name, parentPath, value, docString, format, addNotification } = props; const renderCount = useRef(0); const [open, setOpen] = useState(true); useEffect(() => { renderCount.current++; }); useEffect(() => { addNotification(`${parentPath}.${name} changed.`); }, [props.value]); return (
setOpen(!open)} style={{ cursor: 'pointer' }} // Change cursor style on hover > {name} {open ? : } {process.env.NODE_ENV === 'development' && (

Render count: {renderCount.current}

)} {/* Your component JSX here */} {format === '' && value === '' ? (

No image set in the backend.

) : ( )}
); });