Skip to content

Using Extract Component to File in Client component in NextJS13 breaks it #188

@yafkari

Description

@yafkari

I am working on a project on NextJS 13 and tried to extract a component to a file.
I had a 'use client' at the top of the file but after extracting it, the extension added the import to the extracted component and broke the first line that was supposed to be "use client".

Before:

'use client'

// my imports

After:

import { ExtractedComponent ] from './ExtractedComponent'
;('use client')

// my imports

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