I'm in the process of migrating my site from Create React App to Next.js and I'd like some clarification on how a React component which holds state and has conditionally rendered components is rendered.
On my website, I'm using the react-type-animation package to initially animate the Hero text of my landing page, and only after this text has been rendered the other components become visible/begin their animations. The logic for if the text has finished animating is this:
const [line1Complete, setLine1Complete] = useState(false);
<TypeAnimation
sequence={[
`Hi, I'm Jack`,
() => {
setLine1Complete((line1Complete) => {
return !line1Complete;
});
},
]}
cursor={false}
wrapper="div"
speed={30}
className={
"m-0 text-white text-5xl sm:text-6xl md:text-7xl font-bold w-full text-left"
}
/>
The other components have classNames which conditionally change when line1Complete is set to true.
The main reason for wanting to migrate my website to Next.js is to make use of the Server Side Rendering and improve first contentful/meaningful paint however I'm wondering if this conditional rendering based on state is going to slow down the process. To the best of my understanding, Server Side Rendering works by serving the client all Static HTML for the page first and then the page is hydrated once the React javascript is loaded. Does this mean that once the static HTML is loaded onto the page, the client is going to have to wait for the React bundle to download and execute before the typing animation begins and therefore any other animations on the page?
If this is the case, the render will still be faster as the hidden elements will already have been served to the page but the user doesn't necessarily benefit from this if they can't see the elements.
Any description/useful resources would be appreciated to help me further understand this process.