Hydratation error
Answered
Irish Terrier posted this in #help-forum
Irish TerrierOP
Before Next 15.x I've always used this "trick" to correctly initialyze viewport height to be used with css like this
This script is added in the <head/> so basically is executed before any element is painted but soon enough to calculate the height of the viewport. Then I'll use
So far so good, I can style fullscreen hero without using vh units in a completely safe and cross browsers way. Till next 15; now I get hydratation issues, because the html style tag doesn't match.
So as far as I understand, this can't be done anymore?
<script
dangerouslySetInnerHTML={{
__html: `document.documentElement.style.setProperty('--root-height', window.innerHeight + "px");`,
}}
/>
This script is added in the <head/> so basically is executed before any element is painted but soon enough to calculate the height of the viewport. Then I'll use
.element {
height: var(--root-height)
}
So far so good, I can style fullscreen hero without using vh units in a completely safe and cross browsers way. Till next 15; now I get hydratation issues, because the html style tag doesn't match.
So as far as I understand, this can't be done anymore?