@@ -106,12 +106,8 @@ import { LazyImage } from "react-lazy-images";
106
106
107
107
< LazyImage
108
108
src= " https://www.fillmurray.com/g/600/400"
109
- placeholder= {({ cls }) => (
110
- < img src= " https://www.fillmurray.com/g/60/40" className= {cls} / >
111
- )}
112
- actual= {({ cls }) => (
113
- < img src= " https://www.fillmurray.com/g/600/400" className= {cls} / >
114
- )}
109
+ placeholder= {() => < img src= " https://www.fillmurray.com/g/60/40" / > }
110
+ actual= {() => < img src= " https://www.fillmurray.com/g/600/400" / > }
115
111
/ > ;
116
112
```
117
113
@@ -135,28 +131,28 @@ Thus, whether you want to display a simple `<img>`, your own `<Image>`, or even
135
131
src= {https: // www.fillmurray.com/g/600/400}
136
132
// This is rendered first
137
133
placeholder= {
138
- ({cls} ) =>
139
- < img src= " https://www.fillmurray.com/g/60/40" className = {cls} / >
134
+ () =>
135
+ < img src= " https://www.fillmurray.com/g/60/40" / >
140
136
}
141
137
// This is rendered once in view
142
138
actual= {
143
- ({cls} ) =>
144
- < img src= " https://www.fillmurray.com/g/600/400" className = {cls} / >
139
+ () =>
140
+ < img src= " https://www.fillmurray.com/g/600/400" / >
145
141
}
146
142
/ >
147
143
148
144
// Perhaps you want a container?
149
145
< LazyImage
150
146
placeholder= {
151
- ({cls} ) =>
152
- < div className= {` LazyImage-Placeholder ${ cls } ` }" >
147
+ () =>
148
+ < div className= {` LazyImage-Placeholder` }" >
153
149
<img src=" https: // www.fillmurray.com/g/60/40"/>
154
150
< / div>
155
151
}
156
152
actual= {
157
- ({cls} ) =>
158
- < div className= {` LazyImage-Actual ${ cls } ` }>
159
- < img src= " https://www.fillmurray.com/g/600/400" className = {cls} / >
153
+ () =>
154
+ < div className= {` LazyImage-Actual` }>
155
+ < img src= " https://www.fillmurray.com/g/600/400" / >
160
156
< / div>
161
157
}
162
158
/ >
@@ -178,15 +174,15 @@ This behaviour is provided with the `src` prop:
178
174
< LazyImage
179
175
src= " https://www.fillmurray.com/g/600/400"
180
176
placeholder= {
181
- ({cls} ) =>
182
- < div className= {` LazyImage-Placeholder ${ cls } ` }" >
177
+ () =>
178
+ < div className= {` LazyImage-Placeholder` }" >
183
179
<img src=" https: // www.fillmurray.com/g/60/40"/>
184
180
< / div>
185
181
}
186
182
actual= {
187
- ({cls} ) =>
188
- < div className= {` LazyImage-Actual ${ cls } ` }>
189
- < img src= " https://www.fillmurray.com/g/600/400" className = {cls} / >
183
+ () =>
184
+ < div className= {` LazyImage-Actual` }>
185
+ < img src= " https://www.fillmurray.com/g/600/400" / >
190
186
< / div>
191
187
}
192
188
/ >
@@ -202,17 +198,14 @@ You can choose what to display on Loading and Error using the render props `load
202
198
< div className= " bg-light-silver h5 w-100" >
203
199
< LazyImage
204
200
src= " https://www.fillmurray.com/notanimage"
205
- placeholder= {({ cls }) => < div className= {cls} / > }
206
- actual= {({ cls }) => (
207
- < img src= " https://www.fillmurray.com/notanimage" className= {cls} / >
208
- )}
209
- loading= {({ cls }) => (
210
- < div className= {cls}>
201
+ actual= {() => < img src= " https://www.fillmurray.com/notanimage" / > }
202
+ loading= {() => (
203
+ < div>
211
204
< p className= " pa3 f5 lh-copy near-white" > Loading... < / p>
212
205
< / div>
213
206
)}
214
- error= {({ cls } ) => (
215
- < div className= { ` bg-light-red h-100 w-100 ${ cls } ` } >
207
+ error= {() => (
208
+ < div className= " bg-light-red h-100 w-100" >
216
209
< p> There was an error fetching this image : (< / p>
217
210
< / div>
218
211
)}
@@ -235,12 +228,8 @@ This behaviour is available by using a `loadEagerly` prop:
235
228
< LazyImage
236
229
loadEagerly
237
230
src= " https://www.fillmurray.com/g/600/400"
238
- placeholder= {({ cls }) => (
239
- < img src= " https://www.fillmurray.com/g/60/40" className= {cls} / >
240
- )}
241
- actual= {({ cls }) => (
242
- < img src= " https://www.fillmurray.com/g/600/400" className= {cls} / >
243
- )}
231
+ placeholder= {() => < img src= " https://www.fillmurray.com/g/60/40" / > }
232
+ actual= {() => < img src= " https://www.fillmurray.com/g/600/400" / > }
244
233
/ >
245
234
` ` `
246
235
0 commit comments