Skip to content

Add alternative React component snippets without import React for new JSX transform #350

@RahulAswal01

Description

@RahulAswal01

Since React 17+, the new JSX transform allows JSX to be used without importing React,
so many React 17+ projects no longer require import React from 'react'.

Currently, all functional and arrow component snippets (rfc, rfce, rafc, rafce, etc.)
inject React imports via shared snippet logic, and there is no variant that omits this.

I checked src/sourceSnippets/components.ts and confirmed that all component snippets
include ...react (or related shared imports), so modern React users always get
import React from 'react'.

Would you be open to adding alternative snippet variants (for example rfcx, rafcex)
that generate components without the React import, while keeping existing snippets
unchanged for backward compatibility?

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