twobin / twobin/react-lazyload
Feature-Request: Conditionally enable LazyLoad
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 485
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I want to be able to conditionally enable/disable the lazy loading on my components - is this possible from within the the lazy load component?
E.g.:
I have CMS elements which can be used above or below the fold. I want to disable lazy loading above the fold and enable it below.
The solution I came up with is to double up on my render method:
```javascript
// Parent
render() {
return(
this.props.enableLazyLoading ? :
)
}
```
But it would be way cooler if I could wrap the render-output itself and just pass the prop.
Something like this:
```javascript
// MyComponent
render() {
return(
Super expensive Content
)
}
```
Any suggestions? Am I missing something? :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.