UNPKG

@yandex/ui

Version:

Yandex UI components

21 lines (20 loc) 636 B
import { FC, ReactNode } from 'react'; interface CollectionContext { createCollection<T>(nodes: ReactNode): T[]; } export interface CollectionComponent<P = {}, T = unknown> extends FC<P> { getCollectionNode(props: P, context: CollectionContext): T; } /** * Реакт-хук для создания коллекций из `children` * с помощью виртуальных компонентов. * * @param props - свойства компонента * * @example * const collection = useCollection({ children }); */ export declare function useCollection<T>(props: { children?: ReactNode; }): T[]; export {};