/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/widget-primitives/src/components/widget-render/widget-render.tsx
37 строк
1 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { getLazyWidgetComponent } from '../../tools/get-lazy-widget-component'; import type { ResolveWidgetModule, WidgetType } from '../../types'; interface WidgetRenderProps< Item = unknown > { widgetType: WidgetType< Item >; attributes?: Item; setAttributes?: ( next: Partial< Item > ) => void; resolveWidgetModule: ResolveWidgetModule; } /* * Resolves a widget type's `renderModule` via `resolveWidgetModule` and * mounts the resulting component with the `attributes`/`setAttributes` * render contract. */ export function WidgetRender< Item = unknown >( { widgetType, attributes, setAttributes, resolveWidgetModule, }: WidgetRenderProps< Item > ) { const WidgetComponent = getLazyWidgetComponent( widgetType.renderModule, resolveWidgetModule ); return ( <> { /* Cached `lazy()` keyed by renderModule; identity is stable across renders. */ } { /* eslint-disable-next-line react-hooks/static-components */ } <WidgetComponent attributes={ attributes } setAttributes={ setAttributes } /> </> ); }