+
{renderContent()}
diff --git a/packages/devextreme-react/src/core/use-option-scanning.ts b/packages/devextreme-react/src/core/use-option-scanning.ts
index e43b746978e..060a18fbd69 100644
--- a/packages/devextreme-react/src/core/use-option-scanning.ts
+++ b/packages/devextreme-react/src/core/use-option-scanning.ts
@@ -5,6 +5,7 @@ import {
useContext,
useRef,
useLayoutEffect,
+ RefObject,
} from 'react';
import { ElementType, getElementType, IOptionElement } from './configuration/react/element';
@@ -17,7 +18,7 @@ import { NestedOptionContext, NestedOptionContextContent } from './contexts';
export function useOptionScanning(
optionElement: IOptionElement,
children: ReactNode,
- templateContainer: HTMLDivElement,
+ templateContainer: HTMLDivElement | RefObject,
parentUpdateToken: symbol,
parentType: 'option' | 'component',
): [
@@ -77,7 +78,11 @@ export function useOptionScanning(
};
useLayoutEffect(() => {
- const hasTemplateRendered = templateContainer.childNodes.length > 0;
+ const container = templateContainer && "current" in templateContainer
+ ? templateContainer.current
+ : templateContainer;
+
+ const hasTemplateRendered = !!container && container.childNodes.length > 0;
configBuilder.updateAnonymousTemplates(hasTemplateRendered);
}, [parentUpdateToken]);