Support React Server Components in Paragon #3008
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Next.js v13.2+ added support for React's new React Server Components (RSCs), which bring server side rendering to React at the component level. More information here
Paragon makes heavy use of its ThemeProvider via the Container component, which is likely to be all over codebases utilizing Paragon. Because ThemeProvider leverages the Context API, any component or page that uses it will break if that component or page is being rendered as a RSC. This is because Context API is only available to client components, not server components.
To circumvent this issue, I'm adding the 'use client' directive to any Paragon component which makes use of a feature that would designate it as a client component. Note that this is exactly how react-bootstrap solved this issue.
I attempted to update Paragon to use the newest versions of react-bootstrap and bootstrap, but this proved to be very complicated, had several breaking changes, and ultimately I could not get it building and serving satisfactorily.
I'm submitting this as a draft for the time being while I verify that the Container component is the only component which is causing this breaking issue in Paragon.
Deploy Preview
Include a direct link to your changes in this PR's deploy preview here (e.g., a specific component page).
Merge Checklist
example
app?wittjeff
andadamstankiewicz
as reviewers on this PR.Post-merge Checklist