Case Study showing how I optimize landings for faster load times and improved user experience
The company manages a large portfolio of landing pages, each tailored to specific user activity and engagement. These pages play a crucial role in guiding users toward relevant advertisements that match their interests.
With dozens of landing variations and multiple designs for each, the challenge is ensuring these pages perform seamlessly for a global audience. Users from different regions rely on varying internet speeds and devices, making optimization essential for delivering a smooth experience everywhere.
React SPA
Redux
CSS preprocessors
Custom Webpack config
After 18 months of experience with this stack, I've identified a more efficient solution. I will reveal it at the end of the page
Here's an example of how you can prerender routes using the following dummy code:
This example uses Next.js version 12, as it's the latest version compatible with Preact. In newer versions of Next.js, you can achieve the same functionality with React Server Components (recommended).
Whenever possible, do as much processing as you can during the build phase to reduce the amount of JavaScript sent to the client.
Yes, prerendering produces the correct initial HTML. However, React's hydration process requires sending all the JavaScript to the client, so the size of the JavaScript bundle doesn't shrink just because you prerender.
Example belows shows how one would calculate the theme in Astro and pass it a framework component:
Reduced JS bundle size significantly improves performance.
Pages load quicker, enhancing the user experience.
Landings feel faster and more responsive to users.
Fewer users abandon the site during loading, leading to higher engagement.
Better performance drives more traffic to landings, resulting in greater cash flow and higher profits for the business.
A leaner bundle decreases bandwidth usage and can lower server expenses over time.