Skip to content

Avoid making React JSX types global, to play well with other JSX frameworks. #52321

@trusktr

Description

@trusktr

@eps1lon could we export JSX instead of making them global? This would make React play well with other JSX systems.

F.e., in one file that has a React component, and author would place this at the top:

/* @jsxImportSource react */

and then if they have another file with a different system, f.e. using Solid, they could write this at the top:

/* @jsxImportSource solid-js */

and then in the Solid component all the JSX types would be Solid-based JSX types where otherwise React types wouldn't make sense.

If someone only has one JSX system in their app, used in all their JSX files, they can place jsxImportSource in tsconfig.json so as not to have to write it in every .tsx file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions