Skip to content

Instantly share code, notes, and snippets.

@marekpiechut
Last active July 3, 2020 11:58
Show Gist options
  • Select an option

  • Save marekpiechut/64b822663f95186cfa3f0c8a0a716d77 to your computer and use it in GitHub Desktop.

Select an option

Save marekpiechut/64b822663f95186cfa3f0c8a0a716d77 to your computer and use it in GitHub Desktop.
Get lazy loading cheap with intersectionobserver i ccc4a072ab24457ea3de05cd8ed8f5ed
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