강의

멘토링

커뮤니티

Inflearn Community Q&A

xxxxxxxxxx's profile image
xxxxxxxxxx

asked

[Renewal] Creating NodeBird SNS with React

Applying nginx + https

swr 질문있습니다.

Written on

·

181

0

swr을 이용해서 로그인한 데이터 정보를 가져오고있습니다.

const { data: userData, error: err, mutate, revalidate } = useSWR(
"http://localhost:8000/user/me",
fetcher
);
if (!data) {
openModal();
return;
}

이런식으로 처음에 로그인을 하지 않은 사용자가 특정페이지에 접근하면 모달창을 뛰어 로그인을 하세요라는 모달을 띄운 후 확인을 누르면 로그인페이지로 이동하는 로직을 작성할려고 하는데 
Too many re-renders. React limits the number of renders to prevent an infinite loop
이런에러가 발생합니다. 혹시 해결방법이 있을까요?

nodejsreactreduxexpressNext.js

Answer 1

0

xxxxxxxxxx님의 프로필 이미지
xxxxxxxxxx
Questioner

아 해결했습니다. 새벽이라 정신이 혼미하네요

xxxxxxxxxx's profile image
xxxxxxxxxx

asked

Ask a question