• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

화면에 Cannot read properties of undefined (reading 'map') 에러

22.08.25 14:43 작성 조회수 254

0

빠진 컨트롤러 구현하기 강의 도중 로그인 시 다음과 같은 화면이 뜨는데 어느 부분이 문제인지 궁금합니다

네트워크 탭 확인해보면 요청에는 다 응답이 오고 빈값도 없습니다 심지어는 백엔드나 프런트 로그에도 에러가 없어서 문제를 모르겠습니다..
React 에러는 front/layouts/Workspace/index.ts 파일의

        <Workspaces>
          {userData?.Workspaces.map((ws) => {
            console.log(ws);
            return (
              <Link key={ws.id} to={`/workspace/${ws.url}/channel/일반`}>
                <WorkspaceButton>{ws.name.slice(0, 1).toUpperCase()}</WorkspaceButton>
              </Link>
            );
          })}
          <AddButton onClick={onClickCreateWorkspace}>+</AddButton>
        </Workspaces>

map 함수 부분에서 에러가 나는거 같습니다.

답변 2

·

답변을 작성해보세요.

0

deserializeUser 에서 typeorm 버전맞추다가 relations: ['Workspaces'],을 지워놓고 있었네여..해결했습니다

0

GET user같은 요청의 Workspaces가 잘 들어있는지를 보셔야겠죠?