Skip to content

[suggestion] improve error message when component is missing 'use client' #803

@jldec

Description

@jldec

This is a small thing but I've been caught a few times writing a client component and forgetting the 'use client' directive and then getting confused by the error message. (Cursor made the same mistake today as well)

rwsdk error

useState is not a function or its return value is not iterable

Image

nextjs error

You're importing a component that needs useState. This React Hook only works in a Client Component. To fix, mark the file (or its parent) with the "use client" directive.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.xIssues planned for a minor release after 1.0area:error-messagesIssues related to improving error messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions