Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "use client" directive for a proper usage with Next App Router #2672

Open
1 task done
MoOx opened this issue May 23, 2024 · 3 comments · May be fixed by #2680
Open
1 task done

Add "use client" directive for a proper usage with Next App Router #2672

MoOx opened this issue May 23, 2024 · 3 comments · May be fixed by #2680
Labels
enhancement Requires extension or creation of new React Native API

Comments

@MoOx
Copy link
Contributor

MoOx commented May 23, 2024

Is there an existing request?

  • I have searched for this request

Describe the feature request

Would you be open to add React "use client" directive to all files that requires it so react-native-web can be easily used with Next.js without having to add this directive too early on pages ?

Problem when you add it yourself in your pages or in some component that use RNW primitives: this can conflict with some Server Components or server code that will try to be bundled in frontend bundle.

I can do a PR for this, if you are open to.

@MoOx MoOx added the enhancement Requires extension or creation of new React Native API label May 23, 2024
@necolas
Copy link
Owner

necolas commented May 23, 2024

I think RSC needs to rethink use client if I have to add use client to every file

@MoOx
Copy link
Contributor Author

MoOx commented May 23, 2024

Thing is: Next.js decided to have "use server" as the default directive if none.
So every client components, components that use context or state etc, need to specify the client directive.
I patched RNW locally and have 12 directives for now.

@necolas
Copy link
Owner

necolas commented May 23, 2024

Maybe they should support configuring the directive for dependencies with no directive

necolas pushed a commit that referenced this issue Jun 6, 2024
Close #2678
Fix #2672

Co-authored-by: evanbacon <bacon@expo.io>
@necolas necolas linked a pull request Jun 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requires extension or creation of new React Native API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants