Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useInViewport 弄一個triggerOnce的參數比較好 #2531

Open
wildfrontend opened this issue Apr 24, 2024 · 3 comments · May be fixed by #2539
Open

useInViewport 弄一個triggerOnce的參數比較好 #2531

wildfrontend opened this issue Apr 24, 2024 · 3 comments · May be fixed by #2539
Labels
feature New feature or request

Comments

@wildfrontend
Copy link

我需要trigger一次就行,sourcecode 沒法傳參數去關掉observer, 以避免多餘的state render
可參考https://www.npmjs.com/package/react-intersection-observer

@wildfrontend
Copy link
Author

  const [inViewport] = useInViewport(
    getTargetElement(() =>
      isFirstLoad.current === false ? document.getElementById(domId) : null
    )
  );

目前我是這樣做control 不知道這樣可否,不然就這樣就好

@liuyib
Copy link
Collaborator

liuyib commented Apr 24, 2024

可以支持,欢迎贡献 PR~

@liuyib liuyib added the feature New feature or request label Apr 24, 2024
@LingJinT
Copy link

let me try

@LingJinT LingJinT linked a pull request Apr 28, 2024 that will close this issue
18 tasks
liuyib added a commit to LingJinT/hooks that referenced this issue Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants