-
Notifications
You must be signed in to change notification settings - Fork 335
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
Support for server components #347
Comments
Nothing against it at all. IIRC the issue with splitting is that it requires restructuring the actual encoder to work with our current toolchain.
I don't see any actual documentation on what can or cannot be imported in server components. I can start a next project and go through trial and error, but that's not ideal. |
Cool!
I believe that it applies to anything that’s stateful. E.g. #188 is a step in the right direction, it’s just missing |
The other PR is going to need to be updated a bunch anyway so feel free to make a new one. Like I said though, splitting the components is easy enough. The tooling right now blows up generating the TS declaration once you split and that's the bigger effort. |
Looks like we can get away with something even simpler: #352. Typescript tooling and file splitting can be done later (much later TBH). |
👋 @zpao! Just curious if you have any plans to support server components. I am experimenting with og images in Next.js (
vercel/satori
), writing something like this:This code works!
However, there are warnings during
next dev
,next build
andnext start
If I addexport const runtime = "edge";
to the file:Regardless of Next.js intricacies, it seems that
qrcode.react
lacks React server component support. This line imports hooks that are not available on the server:qrcode.react/src/index.tsx
Line 7 in df6d610
What do you think about splitting canvas and svg implementations into two files? If we import an SVG, it can be server-rendered. If it’s a canvas, there is
"use client"
on top. I reckon that bothQRCodeCanvas
andQRCodeSVG
can be still re-exported fromsrc/index.tsx
, so the change is non-breaking.The text was updated successfully, but these errors were encountered: