static sites eat traffic spikes for breakfast. this makes them super lucrative.
but, there's a bunch of things to be careful about when using static pages to serve content:
@_NamHai@AristideBenoist@Anemolito@ZajnoCrew@brijanp Sorry to jump in - but in general Intersection Observer is a better choice than something like a scroll event listener.
Again - a lot less CPU intensive & as a result, lot more smooth.
@coderNadir@freeCodeCamp@JajaDavid8 What you state is legit. But, you'll hear most marketing & product managers ask for "infinite scroll" - esp for eComm & marketing sites.
static sites eat traffic spikes for breakfast. this makes them super lucrative.
but, there's a bunch of things to be careful about when using static pages to serve content:
@swedenappz got it, makes sense.
Btw, just in case if you know the aspect-ratio in advance, things would work if you can set width & aspect-ratio.
But, agree - that without knowing dimensions and having to place additional info would need JS driven solution.
@git_robo It's a lot more secure to store the JWT as httponly cookie and then read the cookie header on the server-side for the auth.
Keeping cookie access away from browser-side JS prevents XSS attacks.
@zalimidis@murshidmuzamil bfcache works wonders, but only when navigating back / forward between pages.
For CLS issues otherwise, setting the aspect-ratio in advance or specifying image dimensions in HTML is the way out.
@june_dang0706 While Intersection Observer is a great API - native lazy loading is a lot simpler to implement solution wrt. images lazy loading.
For the rest, like you mentioned, IntersectionObserver does the job.
@swedenappz Have found both native lazy loading / intersection observer to be very reliable. what specific issue you faced when trying either of these?
@markozxuu 1. Hydration isn't limited to SSG but is also experienced with SSR (server-side rendered) pages.
2. React server components works for components that do not require JS (eg - blog post content) but not for those that need JS (eg - datetime picker). With RSC, there's no hydration
@jpd1738@nextjs@vercel@googleanalytics Check out simple analytics / plausible - these have a lower impact on your site-speed & are privacy friendly analytics.
Note - they may not offer every metric that GA offers.