/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/components/src/view/component.tsx
47 строк
1 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { forwardRef } from '@wordpress/element'; import type { WordPressComponentProps } from '../context'; import { PolymorphicElement } from '../utils/polymorphic-element'; type ViewProps< T extends React.ElementType > = WordPressComponentProps< {}, T > & { /** * Legacy Emotion prop accepted as a no-op by `View` so it does not leak to * the rendered element. * * @deprecated This prop no longer has any effect. * @ignore */ css?: unknown; }; function UnforwardedView< T extends React.ElementType = 'div' >( { css, ...restProps }: ViewProps< T >, ref: React.ForwardedRef< any > ) { void css; return <PolymorphicElement ref={ ref } { ...restProps } />; } /** * `View` is a core component that renders everything in the library. * It is the principle component in the entire library. * * ```jsx * import { View } from `@wordpress/components`; * * function Example() { * return ( * <View> * Code is Poetry * </View> * ); * } * ``` */ export const View = Object.assign( forwardRef( UnforwardedView ), { selector: '.components-view', } ); export default View;