react-preload
react-preload copied to clipboard
cache overflow and ready prop features
Hi, the component looks nice, unfortunately I cannot use it as is for my use case, which is:
SPA that shows pages of images, preloading the next page until the user forces it to show.
This can be supported by adding two features:
- Pass a ready prop that would override internal state and show the children, which would allow an external event like user interaction to affect things regardless of preload status.
- Specify max cache size that would ensure older images get dropped from the cache.
I can work around the "ready prop" by doing something like:
render() {
const {ready, children, ...other} = this.props
return (
{ready ? <Preload {...other}>{children}</Preload> : {children}}
)
}
But seems that encapsulating this may be cleaner.