inflearn logo
Khóa học

Khóa học

Chia sẻ kiến thức

Bài viết của song

song song

@johyesong86860969

Số lượng đánh giá đã viết
1
Xếp hạng trung bình
5.0

Bài viết 33

Hỏi & Đáp

swr관련 질문

그런데 제가 갑자기 든 의문인데..swr로는 상태 관리가 그러면 불가능 하죠 ? 그러면 swr로 받아온 값들을 리덕스에 useselector처럼 여러 컴포넌트에서 사용할 수 없겠네요 ..?props로 넘겨주는 방법 말고는.. ?

Lượt thích
0
Số bình luận
4
Lượt xem
394

Hỏi & Đáp

swr관련 질문

역시 제로초님은 정말 짱이시네요..!

Lượt thích
0
Số bình luận
4
Lượt xem
394

Hỏi & Đáp

안녕하세요 제로초님

감사합니다!!!!!

Lượt thích
0
Số bình luận
4
Lượt xem
450

Hỏi & Đáp

안녕하세요 제로초님

앗 실 서버는 저런 설정이 필요하고 localhost에서는 sameSite 쿠키 설정이 필요없는건가요 ?! (항상 빠른 답변 감자합니다....) local에서는 credentials: true,만 설정 하면 되나요 ?

Lượt thích
0
Số bình luận
4
Lượt xem
450

Hỏi & Đáp

안녕하세요

감자합니다~~

Lượt thích
0
Số bình luận
2
Lượt xem
385

Hỏi & Đáp

안녕하세요

이런...멍청 ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ한 실수네요..하..참 ㅠㅠ창피해 죽겠네요.. 제대로 출력 하면 ㅠㅠ console . log ( window . scrollY , document . documentElement . clientHeight , document . documentElement . scrollHeight ) 본론으로 돌아와서... document.documentElement.scrollHeigh 가 증가하면 안된다고 하셨는데.. 여기에서 증가하는 모습을 보입니다.. 그래서ㅜㅜ 저는 이게 맞는 거라고 생각했는데.. ㅠㅠㅠ "세번째 답글"에 올렸던 console.log(window.pageYOffset , document.documentElement.clientHeight , document.documentElement.scrollHeight); 과 다른 모습을 볼 수 있습니다. 제 생각에는 특정 '0'이될때가 아닌 크기가 변하지 않아, 0 768 880인 경우에도 조건에 성립 하여서 생긴 문제라고 생각했습니다ㅜㅜ if ( window . pageYOffset + document . documentElement . clientHeight > document . documentElement . scrollHeight - 300 ) *추가적으로 말씀해 주셨던 loadPost s Loading는 ...reducers/post.js에서도 제가 단수로 명시했더라구요 ㅎㅎ 제로초님이 싫어하시는 단수 복수 규칙을 명확하게 지키지 않았습니다 ..ㅎㅎ 그래도 결과는 변함 없이 나오고 있었습니다! ㅠㅠ 이런 상황도 브라우저에 따라 스크롤 관련 버그 인건지요 ㅜㅜ

Lượt thích
0
Số bình luận
9
Lượt xem
564

Hỏi & Đáp

안녕하세요

그러네요 ㅜㅜ 바로 위에 console 찍은 코드는 이건데.. import React, { useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import PostForm from '../components/PostForm'; import PostCard from '../components/PostCard'; import AppLayout from '../components/AppLayout'; import { LOAD_POSTS_REQUEST } from '../reducers/post'; import { LOAD_MY_INFO_REQUEST } from '../reducers/user'; const Home = () => { const dispatch = useDispatch(); const { me ,logInError} = useSelector((state) => state.user); const { mainPosts, hasMorePosts, loadPostsLoading,retweetError } = useSelector((state) => state.post); useEffect(() => { if (retweetError) { return alert(retweetError); } }, [retweetError]) useEffect(() => { if (logInError) { return alert(logInError); } }, [logInError]) useEffect(() => { dispatch({ type:LOAD_MY_INFO_REQUEST }); dispatch({ type: LOAD_POSTS_REQUEST, }); }, []); useEffect(() => { function onScroll() { if (window.scrollY + document.documentElement.clientHeight > document.documentElement.scrollHeight - 300) { console.log(window.screenY,document.documentElement.clientHeight ,document.documentElement.scrollHeight ) if (hasMorePosts && !loadPostsLoading) { const lastId=mainPosts[mainPosts.length -1]?.id;//없을경우도 있으니까 dispatch({ type: LOAD_POSTS_REQUEST, data:lastId }); } } } window.addEventListener('scroll', onScroll); return () => { window.removeEventListener('scroll', onScroll); }; }, [mainPosts, hasMorePosts, loadPostsLoading]); return ( {me && } {mainPosts.map((c) => ( ))} ); }; export default Home; 뭐가 문제 인지 찾아보겠습니다 ㅠ.ㅠ.......

Lượt thích
0
Số bình luận
9
Lượt xem
564

Hỏi & Đáp

안녕하세요

아 왜 그러냐면 제가 수업 듣고 복습 용이랑 혼자 작성용 코드를 두개를 써서 하는데 다른 코드에서는 document.documentElement.scrollHeigh 가 증가했습니다 ㅠㅠ 그래서 증가해야 된다고 생각했던 것 같습니다 ㅜㅜ지금 사진은 LOAD_POSTS될시에 console.log(window.screenY,document.documentElement.clientHeight,document.documentElement.scrollHeight ) 결과 입니다. 조건은 이구요 if ( window . scrollY + document . documentElement . clientHeight > document . documentElement . scrollHeight - 300 )

Lượt thích
0
Số bình luận
9
Lượt xem
564

Hỏi & Đáp

안녕하세요

우선 load_post 되는 시점에 console을 찍어보면 if ( window . pageYOffset + document . documentElement . clientHeight > document . documentElement . scrollHeight - 300 ) 일시에 출력되게 했습니다. document.documentElement.scrollHeight가 변경이안되고있는것 같습니다. 그리고 추가적으로 LOAD_POSTS가 동시에 여러번 실행 되는것 같습니다. (throttle와 if (hasMoreposts && !loadPostLoading) 조건 사용) ㅠㅠ

Lượt thích
0
Số bình luận
9
Lượt xem
564