Closed simplenotezy closed 4 years ago
What does your SSR process look like? If for some reason typeof window !== 'undefined'
in your SSR environment, the component does not render.
From the Basic example:
- The ArticleContent component is only loaded in SSR mode, which means it never gets hydrated in the browser, which also means it will never be interactive (static content only).
- Next we can see the AdSlider beneath the article content, this component will most likely not be visible initially so we can delay hydration until the point it becomes visible.
ssr-only
-> the component never gets hydrated on the client.
when-visible
-> the component gets hydrated when visible.
None of those two is better per se. If you have only static content with no interactivity, ssr-only
is the best choice. If your component has functionality (e.g. buttons and other interactive elements) ssr-only
is not a choice, because your component will not work when using it.
@maoberlehner Maoberlehner, I just tested in normal yarn dev
. I don't have that typecheck on window in my SSR.
Thanks for the clarification in regards to the different options.
Can you do both? E.g.:
<LazyHydrate ssr-only when-visible>
I had some <client-only>
within <LazyHydrate>
and that caused the block to never show up. I removed it, and then it worked. 😊
If I use
<LazyHydrate srr-only>
around some static component, it is never shown. I tried changing it towhen-visible
and that works fine. Also I am not quite sure of the difference between the two, despiste having read the documentation and tutorial. Isn'twhen-visible
better?