Skip to content

What is the right way to use generic components with JSX? #3960

Closed
@s-panferov

Description

@s-panferov

Hello,

I have a generic component, e.g. class Select<T> extends React.Component<SelectProps<T>, any>. Is there any "right" way to use it from JSX?

It is impossible to write something like <Select<string> /> in JSX. The best thing that I've found is to write

let StringSelect: React.Component<SelectProps<string>, any> = Select;

And use StringSelect instead of Select<string>. Is there anything better?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionIssues which may not have code impactDomain: JSX/TSXRelates to the JSX parser and emitter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions