Here's how im thinking to solve rendering the minimal amount of CSS on the server while also not blowing out the bundle size 馃憞
1
3
1. Context on the server. It's the only solution because of async ssr. Singleton won't work like I thought it could before (and tbh the api was yuck, having a flush func to call after SSR? Gross!) Each compiled component needs to both be a context provider and consumer.
2
I assumed there needs to be a provider *somewhere* above any compiled component, but not necessarily wrapping every compiled component. What am I missing?
1
1
that's why (on the server) every compiled component will be BOTH a provider AND a consumer it keeps it 0 config - so you as a consumer don't have to worry about it
1
so the top most compiled component will be the one to create the actual data - and then every child will read from it
2
But the children shouldn't need to be a provider; their children are already part of the context hierarchy no? Could they check the context for a non-null value and skip adding a provider?
1
1
hmmm, yes i think so 馃檪

Apr 20, 2020 路 1:11 AM UTC

1