Replies: 1 comment 1 reply
-
|
Many (but not all) USWDS components require client-side interactivity. USWDS JS is not component-ized, it's imported wholesale which works against many Next.js paradigms. For our Next.js/USWDS project (using USWDS 3x), we believed our best bet was to re-implement any USWDS JS in React, then decide from there whether a component could be server-rendered. Ad-Hoc's uswds-react repo provided a good starting point for that. USWDS is moving to web components, which I believe are becoming increasingly compatible with SSR frameworks (still with kinks to work out though). I haven't tried that approach myself, so I'm curious how that progresses. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm curious to hear if anyone is effectively using USWDS on a Next.js app with SSR (or some other SSR framework). Based on my understanding and limited experience with Next.js, it appears as if it doesn't seem possible to effectively use USWDS on an SSR Next.js app...this being due to the fact that some USWDS components make use of the document and/or window objects.
So based on that, my assumption is that any pages that make use of USWDS components can't be server rendered, effectively eliminating the major reason for using Next.js. And my assumptions are based on current, production ready Next.js functionality. I'm guessing Partial Pre-Rendering might help with that.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions