Skip to content

Quick Fix command for missing React component imports does not work without React in the scope even with the new JSX factory enabled in Next.js that makes the React import unnecessary #41466

Open
@ChristianIvicevic

Description

@ChristianIvicevic
  • VSCode Version: 1.51.0
  • OS Version: macOS 10.15.7
  • Typescript Version: 4.0.5

Steps to Reproduce:

  1. Clone the following repository: https://github.com/ChristianIvicevic/react-jsx-factory-repro
  2. yarn install all dependencies
  3. Open the index.tsx and add the SampleComponent without automatic completion and import of the component
  4. Try to use Quick Fix on the SampleComponent to automatically add its import
  5. Only the fix to import React is available initially - apply this Quick Fix
  6. Open the Quick Fix for a second time - now you are able to add the import for the SampleComponent

Here is a gif of the differences with automatic import and with Quick Fixes:

Kapture 2020-11-09 at 02 20 10

With the newest version of Next.js it is no longer necessary to import the default export of React, thus step 5 should not appear in the first place.

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions