Skip to content

Commit ae5d9ab

Browse files
committed
Small refactor to avoid passing the 'image' parameter around
1 parent c8c6246 commit ae5d9ab

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/components/LazyLoadImage.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class LazyLoadImage extends React.Component {
4646
return <img onLoad={this.onImageLoad()} {...imgProps} />;
4747
}
4848

49-
getLazyLoadImage(image) {
49+
getLazyLoadImage() {
5050
const {
5151
beforeLoad,
5252
className,
@@ -77,7 +77,7 @@ class LazyLoadImage extends React.Component {
7777
visibleByDefault={visibleByDefault}
7878
width={width}
7979
>
80-
{image}
80+
{this.getImg()}
8181
</LazyLoadComponent>
8282
);
8383
}
@@ -123,8 +123,7 @@ class LazyLoadImage extends React.Component {
123123
render() {
124124
const { effect, placeholderSrc, visibleByDefault } = this.props;
125125

126-
const image = this.getImg();
127-
const lazyLoadImage = this.getLazyLoadImage(image);
126+
const lazyLoadImage = this.getLazyLoadImage();
128127

129128
if ((!effect && !placeholderSrc) || visibleByDefault) {
130129
return lazyLoadImage;

0 commit comments

Comments
 (0)