Skip to content

JSX: "extract to constant" generates invalid code when using fragment syntaxΒ #44249

Closed
@OliverJAsh

Description

@OliverJAsh

Bug Report

πŸ”Ž Search Terms

Related: #29890

jsx extract constant refactoring quick fix

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about refactorings

⏯ Playground Link

N/A

πŸ’» Code

<>
    <span>Hello</span>
</>
  1. Highlight <span>Hello</span>
  2. Run refactoring "extract to constant"

πŸ™ Actual behavior

const newLocal = <span>Hello</span>;
<>
    newLocal
</>

πŸ™‚ Expected behavior

const newLocal = <span>Hello</span>;
<>
    {newLocal}
</>

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions