Skip to content

Carousel throws error inside server component #1094

Open
@EPurwanto

Description

@EPurwanto

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Code Sandbox link

https://codesandbox.io/p/devbox/zcfnc2

Bug report

The Carousel component throws an error when used in a server component in NextJS 15:
> TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it.

This is because the component makes use of a context but is not marked as a client component. 

As a work around, I can wrap the Carousel in a client component that just forwards props, but if a context is essential to it's operations it should be marked as a client component with "use client".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueInterested in contributing? This is a great place to start.Issue: AcceptedThis issue has been tested and has been verified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions