question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[useIntersectionObserver] Introduce new API

See original GitHub issue

Note: This proposal is in its very early stage.

The Intersection Observer API provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document’s viewport.

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

Implementation should somewhat look like useScrollTrigger

Current Behavior 😯

User implemented

Examples 🌈

Context 🔦

  • Mount component when it intersects with the DOM.

Benchmark

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
maerzhasecommented, Dec 11, 2020

IMHO if you decide on using a generic library (e.g. react-intersection-observer) material-ui itself should focus on providing a component-based API e.g. the Reveal component I propose in #23960 and not a hook-based API like useScrollTrigger, because it would obfuscate the usage of the library somehow.

1reaction
oliviertassinaricommented, Jul 24, 2019

To further expand on my reasoning.we can compare the usage rate between the generic API https://github.com/thebuilder/react-intersection-observer and the specialized one: https://github.com/jasonslyvia/react-lazyload, https://github.com/bvaughn/react-virtualized. There is a x10 difference. I believe working on this would be a distraction for us.

In the future, I think that it would be great to explore the potential of an image component for Material-UI. Maybe something that comes with display transition, lazyload, error handling. Not a priority either, but I’m wondering about the potential 🤔.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Intersection Observer API - MDN Web Docs
The Intersection Observer API provides a way to asynchronously observe changes in the intersection of a target element with an ancestor ...
Read more >
Introducing the Intersection Observer API | by John Au-Yeung
In this article, we'll look at how to use the Intersection Observer API to watch for visibility changes for a child element.
Read more >
Intersection Observer - W3C
The Intersection Observer API enables developers to understand the visibility and position of target DOM elements relative to an intersection ...
Read more >
What is Intersection Observer API and how is it useful?
Intersection Observer API is a browser API that can be used to observe and listen to the changes intersecting with the viewport.
Read more >
Introduction to the Intersection Observer JavaScript API
Introduction to the Intersection Observer JavaScript API · You can find the code here: · Use the following link to get 2 FREE...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found