Skip to content

Conversation

@lucasconstantino
Copy link
Contributor

@lucasconstantino lucasconstantino commented Jun 13, 2022

⚠️ Warning

The changes contained in this PR are considered advanced, and won't be part of the final application. We'll leave it here as a reference and for learning purposes.


This PR intends to showcase two things:

  1. Real world use case of a HOC (Higher-Order Component)
  2. How to use HOCs to decouple concerns

The idea here is we abstract away the whole styles SSR logic – which was copied from Next.js' official styled-components example – out of the _document.tsx page. The intention is to isolate the complexity of this styles SSR process, and make our custom Document as simple as possible, with only application concerns and not low-level SSR concerns.

Besides that, having the styles SSR encapsulated allows the Document to embark other eventual getInitialProps needs that might become necessary, without us having to mingle the complexity of multiple different concerns.

@vercel
Copy link

vercel bot commented Jun 13, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
frontend-academy-2022 ✅ Ready (Inspect) Visit Preview Jun 13, 2022 at 1:47PM (UTC)

@lucasconstantino lucasconstantino changed the base branch from main to fix/ssr-styles June 13, 2022 13:52
@lucasconstantino lucasconstantino marked this pull request as draft June 13, 2022 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants