I am using react-loadable-visibility to achieve lazy imports for a lot of my components and I was trying to synchronously (on a button click) , scroll the user to bottom but the components were not yet loaded so to achieve that, I was trying to benefit from loadable's load function
import loadable from "react-loadable-visibility/loadable-components"
I am using react-loadable-visibility to achieve lazy imports for a lot of my components and I was trying to synchronously (on a button click) , scroll the user to bottom but the components were not yet loaded so to achieve that, I was trying to benefit from loadable's load function
import loadable from "react-loadable-visibility/loadable-components"
const VideoPlayer = loadable(() => import("@components/VideoPlayer"), { ssr: false, fallback: <div></div>, })
The loadable function here returns LoadableVisibilityComponent which exposes preload method but not the load method.
const onButtonClick = () => { VideoPlayer.load().then(() => { // scroll element to view after component bundle is fetched }) }
During runtime, after button click it throws ->
Solution -> Expose loadable-component's load method as well