E
E
Evdokim2021-09-14 13:44:10
Web development
Evdokim, 2021-09-14 13:44:10

Is it possible to use Generic between two different React components?

Let's say there is a SelectableListComponent of the form:

export interface ISelectableListProps<T extends { isDisableInList?: boolean }> {
    items: T[];
    key?: React.ReactText;
    itemTemplate: (item: T) => JSX.Element;
}

const SelectableListComponent = <T extends {}>(props: ISelectableListProps<T>) => <></>


Another component has been created in the SelectableListComponent component space : Is it possible somehow to pass a generic T to the SubComponent too?
SelectableListComponent.SubComponent = () => <></>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question