-
Notifications
You must be signed in to change notification settings - Fork 27k
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
app
dir does not work with React.createContext
#41929
Comments
Same error, different module. Maybe has something to do with them shipping two different versions of react? Mine:
|
I meet the same error when I use in page.tsx:
|
It seems we need to do this https://beta.nextjs.org/docs/rendering/server-and-client-components#convention React context is only for the client side, can someone test it and let me know? I just now reset my git, when it didn’t work, will try in tomorrow |
I'll test here in a few. |
This worked. Moved out of layout.tsx and broke out into navbar.tsx for a quick test.
|
@BWBama85 thank you for testing it!! So now it is clear we cannot use the react hooks on the server so we need to add the |
I think there needs to better error handling saying exactly that^ |
@temrb it is in the beta stage even though the docs are for beta, so we need to accept this pain, the API might also break in the future updates |
I have the same issue, but for react-bootstrap. and also tried with MUI. Not sure how in which side should be fixed for, and what it can be done. But it seems very much like you have to wrap every single client component with "use client" for when you want to use server components on it. |
Hi, this is expected if the component using |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
N/A, but Node.js is v16.18.0
How are you deploying your application? (if relevant)
next dev
Describe the Bug
Using
@emotion/react
asjsxImportSource
does not work withapp
dir, with the following error:console.log(React)
at the error site shows that it indeed doesn’t havecreateContext
.React.version
is18.3.0-next-d925a8d0b-20221024
.Expected Behavior
Using
@emotion/react
asjsxImportSource
works withapp
dir.Link to reproduction
https://replit.com/@alex-kinokon/app-playground
To Reproduce
Set
jsxImportSource
to@emotion/react
intsconfig.json
The text was updated successfully, but these errors were encountered: