All Projects → stereobooster → guide-to-async-components

stereobooster / guide-to-async-components

Licence: MIT license
📖 Guide To JavaScript Async Components

Projects that are alternatives of or similar to guide-to-async-components

Vanilla Lazyload
LazyLoad is a lightweight, flexible script that speeds up your website by deferring the loading of your below-the-fold images, backgrounds, videos, iframes and scripts to when they will enter the viewport. Written in plain "vanilla" JavaScript, it leverages IntersectionObserver, supports responsive images and enables native lazy loading.
Stars: ✭ 6,596 (+8249.37%)
Mutual labels:  lazyload, lazy-loading, responsive-images, lazyload-images
jekyll-loading-lazy
🧙🏽‍♀️ Automatically adds loading="lazy" to <img> and <iframe> tags. Load images on your sites lazily without JavaScript.
Stars: ✭ 41 (-48.1%)
Mutual labels:  lazyload, loading, lazy-loading, lazyload-images
lazysimon
Minimal effort 350 byte JavaScript library to lazy load all <img> on your website
Stars: ✭ 18 (-77.22%)
Mutual labels:  lazyload, lazy-loading, lazyload-images
lazy-load-images.js
Progressive & lazy loading images.
Stars: ✭ 17 (-78.48%)
Mutual labels:  lazyload, lazy-loading, lazyload-images
magento2-catalog-lazy-load
Improve the load time of your Magento 2 categories pages by loading your images on demand with our Lazy Load Extension
Stars: ✭ 56 (-29.11%)
Mutual labels:  lazyload, lazy-loading, lazyload-images
rocket-lazy-load
Standalone LazyLoad plugin for WordPress (based on WP Rocket)
Stars: ✭ 25 (-68.35%)
Mutual labels:  lazyload, lazy-loading, lazyload-images
lazyload-vue
Vue Plugin for vanilla-lazyload
Stars: ✭ 29 (-63.29%)
Mutual labels:  lazyload, lazyload-images
ngx-progressive-image-loader
lazy load img/picture, prevent reflow and seo friendly.
Stars: ✭ 35 (-55.7%)
Mutual labels:  lazyload, lazyload-images
Accessible Image Lazy Load
😴 gandul! accessible lazy loading images
Stars: ✭ 281 (+255.7%)
Mutual labels:  lazyload, lazy-loading
React Lazy Load Image Component
React Component to lazy load images and components using a HOC to track window scroll position.
Stars: ✭ 755 (+855.7%)
Mutual labels:  lazyload, lazy-loading
Lazysizes
High performance and SEO friendly lazy loader for images (responsive and normal), iframes and more, that detects any visibility changes triggered through user interaction, CSS or JavaScript without configuration.
Stars: ✭ 15,716 (+19793.67%)
Mutual labels:  lazyload, responsive-images
React Simple Img
🌅 React lazy load images with IntersectionObserver API and Priority Hints
Stars: ✭ 905 (+1045.57%)
Mutual labels:  lazyload, responsive-images
Jquery.lazy
A lightweight, fast, feature-rich, powerful and highly configurable delayed content, image and background lazy loading plugin for jQuery & Zepto.
Stars: ✭ 965 (+1121.52%)
Mutual labels:  lazyload, lazy-loading
Ng In Viewport
Allows us to check if an element is within the browsers visual viewport
Stars: ✭ 178 (+125.32%)
Mutual labels:  lazyload, lazy-loading
Lozad.js
🔥 Highly performant, light ~1kb and configurable lazy loader in pure JS with no dependencies for responsive images, iframes and more
Stars: ✭ 6,932 (+8674.68%)
Mutual labels:  lazyload, lazy-loading
React Progressive Loader
Utility to load images and React components progressively, and get code splitting for free
Stars: ✭ 224 (+183.54%)
Mutual labels:  lazyload, lazy-loading
loadeer
🦌 Tiny, performant, SEO-friendly lazy loading library
Stars: ✭ 30 (-62.03%)
Mutual labels:  lazyload, lazy-loading
Yall.js
A fast, flexible, and small SEO-friendly lazy loader.
Stars: ✭ 1,163 (+1372.15%)
Mutual labels:  lazyload, lazy-loading
raf-pool
requestAnimationFrame pool to avoid busyness on the thread
Stars: ✭ 16 (-79.75%)
Mutual labels:  lazyload, lazyload-images
Nuxt Lazysizes
Lazysizes module for Nuxt.js
Stars: ✭ 25 (-68.35%)
Mutual labels:  lazyload, lazy-loading

Guide To Async Components

JavaScript async components

Also known as code splitting, dynamic import (TC39 proposal), "chunks" (which are loaded on demand), "layers", "rollups", or "fragments".

Async component (in React) is a technique (typically implemented as a Higher Order Component) for loading components with dynamic import.

See also: Redux modules and code-splitting, lazy loading guidance

Solutions

Strategies

  • Routes to chunks - separate into "chunks" based on routes, possible to do automatically. Example: Next.js.
  • Components to chunks - separate components as "chunks". Example: react-loadable.
  • 🦄 UI tip (components to chunks): show spinner if content not loaded, but do not start spinner earlier then 200ms
  • 🦄 UI tip (routes to chunks): do not show spinner in the center of your page between the content switch, use progress line in the top, like YouTube does. Example: PACE.
  • Speed tip: prefer component placeholder over spinner if possible
  • Speed tip (routes to chunks): you can preload chunk (e.g. next page) on link hover
  • 💣 Caveat (components to chunks): make sure you wait till all components loaded in case of prerendered pages (SSR or snapshots)
  • 🎱 Trick (components to chunks): some components can be skipped in case of SSR, for example, Mapbox map

Placeholders

See also:

Media: images, video

Strategies

  • Lazy load - load images only when they appear on the screen. Use Intersection Observer API or react-waypoint
  • Load on demand. Useful for slow networks or big files, like video or gif.
  • 🦄 UI tip (load on demand): Use download ⬇️ icon for images and play ▶️ icon for animations.
  • 🦄 UI tip: Show error state when image load failed, so the user can click to retry load. Use error ⚠️ or repeat 🔁 icons
  • 🦄 UI tip: Do not try to download the image if the device is offline and image not in the cache. Use cloud off 🚫 icon
  • 💣 UI caveat: make sure that icon and background are in good contrast, especially if you use not constant placeholders. For example, in case of solid color placeholder, you can make sure you pickup contrast color (this what Twitter does) or use a semitransparent gray overlay for bright backgrounds.
  • Speed tip: always use width and height. Use image-size, probe-image-size
  • Speed tip: use small placeholders (plus width and height)
  • Speed tip: optimize images. See essential image optimization
  • Speed tip: use MP4 without sound instead of GIF images
  • Speed tip: provide WebP images instead of JPG images

See also:

Placeholders

  • Constant placeholder - do not use it
  • Solid color or dominant color - fastest and simplest placeholders. Use color-thief to get color info. Used by Twitter, Google, Pinterest
  • LQIP or Low Quality Image Placeholder or Progressive image loading or "Blur-up" - better for perceptual speed than dominant color, but also have a bigger weight. Use lqip or sqip. Used by Facebook and Medium.
  • SVG traced images. There is plugin for Gatsby.

See also:

Responsive (resize) strategies

See also:

Solutions

Resizing images on the fly

Examples from real world

AWS Lambda + S3

Golang + FaaS

Go is the perfect fit for this kind of task. AWS Lambda now supports Go. Also you can use Go with Google Cloud functions.

Infinite scroll

A special case of async components. Example: react-virtualized

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].