Last active
July 3, 2020 11:58
-
-
Save marekpiechut/64b822663f95186cfa3f0c8a0a716d77 to your computer and use it in GitHub Desktop.
Get lazy loading cheap with intersectionobserver i ccc4a072ab24457ea3de05cd8ed8f5ed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ExerciseItem = ({ exercise }: Props) => { | |
| const [url, setUrl] = useState<?string>(null) | |
| useEffect(() => { | |
| thumbLoader(media).then(setUrl) | |
| }, [media, thumbLoader]) | |
| return <div css={styles.thumb} style={{ backgroundImage: `url(${url})` }} /> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment