Skip to content

Preserve 'use client' directive only for one components (not all) ?Β #1

@dcz-switcher

Description

@dcz-switcher

First of all, a big thanks for sharing your work

This is a painful issue when you want to build a shared library for frameworks like NextJS which can render on client and server side

In my case, I have a components folder with one subfolder per component
Only one of them need 'use client' directive (because it use "Context")

In each component's folder I have a index.ts with the export of the component
and at the root of the components folder I have a index.ts with the global export command

I try your code but it seams that the 'use client' directive is set in the index.ej.js of the root
So I think that all components will be tagged as 'client'

I am Right ?
If yes, is there any way to put the directive only on one component ?

Regards

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions