Skip to content

Instantly share code, notes, and snippets.

@amarbalu
Created March 12, 2022 15:57
Show Gist options
  • Save amarbalu/5fa2d242aedf3ec7eaa6b7bdf038ec2a to your computer and use it in GitHub Desktop.
Save amarbalu/5fa2d242aedf3ec7eaa6b7bdf038ec2a to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import Loadable from 'react-loadable'
import createLoadableVisibilityComponent from './createLoadableVisibilityComponent'
import { IntersectionObserver } from './capacities'
function LoadableVisibility (opts) {
if (IntersectionObserver) {
return createLoadableVisibilityComponent([opts], {
Loadable,
preloadFunc: 'preload',
LoadingComponent: opts.loading,
})
} else {
return Loadable(opts)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment