rud167637
@rud1676371262
Reviews Written
1
Average Rating
5.0
Posts
Q&A
REQUEST๋ฅผ ์คํํด๋ loadPostLoading์ด ๋ฐ๋ก ๋ฐ๋์ง ์์ต๋๋ค.
์ ๋ ๊ฐ์ ์๋ฌ์ฟ๋๋ฐ ๋์๋ง์ด๋ซ์ต๋๋ค!์ ์ถ์ธก์ด์ง๋ง addEventListnerํ ์ํ์์dispatch๊ฐ ๋น๋๊ธฐ๋ก ์คํ๋๋ ๋์ ๋น ๋ฅธ์๊ฐ๋ด์ scroll์ด๋ฒคํธ๋ฅผ ๋๋ฒ ๋ถ๋ฅธ๊ฑฐ ๊ฐ๋๋ผ๊ตฌ์ ๊ทธ๋์ onec๋ผ๋ ๋ณ์๋ฅผ ๋ฌ์ useEffect์คํ๋๊ธฐ ์ ์ ํ๋ฒ๋ง ์คํํ๊ฒ๋ ํ๋๋ ๊น๋ํ๊ฒ REQUEST๋ฅผ ํ๋ฒ๋ง ์คํํ์ต๋๋ค. useEffect(() => { let onec = false; function onScroll() { const scrollpos = window.scrollY + document.documentElement.clientHeight; if (scrollpos > document.documentElement.scrollHeight - 300) { if (hasMorePosts && !LoadPostLoading && !onec) { onec = true; console.log('LOADPOSTLOADING', LoadPostLoading); console.log('hasmor', hasMorePosts); dispatch({ type: LOAD_POST_REQUEST, }); } } } window.addEventListener('scroll', onScroll); return () => { window.removeEventListener('scroll', onScroll); }; }, [hasMorePosts, LoadPostLoading]);
- Likes
- 0
- Comments
- 2
- Viewcount
- 402
Q&A
user๋ฅผ ์ฐพ์ ์ ์๋ค๊ณ ๋์์ใ ใ ใ ใ
๊ฐ์ฌํฉ๋๋ค ์ ๋ ์ด๊ฑฐ๋๋ฌธ์ ์ ๋จน๊ณ ์์๋๋ฐ ใ ใ
- Likes
- 8
- Comments
- 8
- Viewcount
- 557




