NicknameEditForm, FollowList가 렌더되지 않습니다
326
작성자 없음
작성한 질문수 0
안녕하세요. 강의 잘 듣고 있습니다.
현재 섹션 1까지 모두 수강하였습니다. 다만 제목과 같이 NicknameEditForm, FollowList 구현부터 웹에 렌더가 되지 않아 진도가 막힌 상태입니다...ㅜㅜ
antd나 스타일 컴포넌트의 문제 같아 환경설정도 변경해보고 VS code를 재다운로드하거나 버전별로 테스트 해보기도 했는데 아직 해결 방법을 찾지 못한 상태입니다.
코드 실행한 결과입니다. 회원 정보 카드 옆에 닉네임 수정 폼이나 팔로우 리스트가 생성되어야 하는데 전혀 뜨질 않네요. 혹시 어떤 해결 방법이 있을까요?
아래는 환경과 작성한 코드입니다.
{
"name": "react-nodebird-front",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "next"
},
"author": "kde",
"license": "ISC",
"dependencies": {
"@ant-design/icons": "^5.1.3",
"antd": "^4.3.1",
"next": "^9.5.5",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^17.0.2",
"styled-components": "^5.3.11"
},
"devDependencies": {
"eslint": "^8.41.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0"
}
}import React, { useCallback } from 'react';
import { Avatar, Button, Card } from 'antd';
const UserProfile = ({ setIsLoggedIn }) => {
const onLogOut = useCallback(() => {
setIsLoggedIn(false);
}, []);
return (
<Card
actions={[
<div key="twit">짹짹<br/>0</div>,
<div key="following">팔로잉<br/>0</div>,
<div key="following">팔로워<br/>0</div>,
]}
>
<Card.Meta
avatar={<Avatar>test</Avatar>}
title="test"
/>
<Button onClick={onLogOut}>로그아웃</Button>
</Card>
);
};
export default UserProfile;import React, { useMemo } from "react";
import { Form, Input } from 'antd';
const NicknameEditForm = () => {
return (
<Form style={{ marginBottom: '20px', border: '1px solid #d9d9d9', padding: '20px' }}>
<Input.Search addonBefore="닉네임" enterButton="수정"/>
</Form>
);
};
export default NicknameEditForm;import React from "react";
import PropTypes from 'prop-types';
import { Button, List, Card } from 'antd';
import { StopOutlined } from '@ant-design/icons';
const FollowList = ({ header, data }) => {
return (
<List
style={{ marginBottom: '20px' }}
grid={{ gutter: 4, xs: 2, md: 3 }}
size="small"
header={<div>{header}</div>}
loadMore={<div style={{ textAlign: 'center', margin: '10px 0' }}><Button>더보기</Button></div>}
bordered
dataSource={data}
renderItem={(item) => (
<List.Item style={{ marginTop: '20px' }}>
<Card actions={[<StopOutlined key="stop"/>]}>
<Card.Meta description={item.nickname}/>
</Card>
</List.Item>
)}
/>
);
};
FollowList.propTypes = {
header: PropTypes.string.isRequired,
data: PropTypes.array.isRequired,
};
export default FollowListimport React, { useState } from 'react';
import PropTypes from 'prop-types';
import Link from 'next/link';
import { Menu, Input, Row, Col } from 'antd';
import UserProfile from '../components/UserProfile';
import LoginForm from '../components/LoginForm';
// const SearchInput = styled(Input.Search)`
// vertical-align: middle;
// `;
const AppLayout = ({ children }) => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
return (
<div>
<Menu mode="horizontal">
<Menu.Item>
<Link href="/"><a>노드버드</a></Link>
</Menu.Item>
<Menu.Item>
<Link href="/profile"><a>프로필</a></Link>
</Menu.Item>
<Menu.Item>
<Link href="/signup"><a>회원가입</a></Link>
</Menu.Item>
<Menu.Item>
<Input.Search enterButton style={{ verticalAlign: 'middle' }}/>
</Menu.Item>
</Menu>
<Row gutter={8}>
<Col xs={24} md={6}>
{isLoggedIn ? <UserProfile setIsLoggedIn={setIsLoggedIn}/> : <LoginForm setIsLoggedIn={setIsLoggedIn}/>}
</Col>
<Col xs={24} md={12}>
</Col>
<Col xs={24} md={6}>
<a href="http://google.com" target="_blank" rel="noreferrer noopener">메인화면</a>
</Col>
</Row>
</div>
);
};
AppLayout.propTypes = {
children: PropTypes.node.isRequired,
};
export default AppLayout;import React, { useState, useCallback, useMemo } from 'react';
import { Form, Input, Button } from 'antd';
import Link from 'next/link';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import useInput from '../hooks/useInput';
// const ButtonWrapper = styled.div`
// margin-top: 10px;
// `;
// const FormWrapper = styled(Form)`
// padding: 10px;
// `;
function LoginForm({ setIsLoggedIn }) {
const [id, onChangeId] = useInput('');
const [password, onChangePassword] = useInput('');
// const style = useMemo(() => ({ marginTop: 10 }), []);
const onSubmitForm = useCallback(() => {
console.log(id, password);
setIsLoggedIn(true);
}, [id, password]);
return (
<Form onFinish={onSubmitForm} style={{ padding: '10px' }}>
<div>
<label htmlFor="user-id">아이디</label>
<br />
<Input name="user-id" value={id} onChange={onChangeId} required />
</div>
<div>
<label htmlFor="user-password">비밀번호</label>
<br />
<Input name="user-password"
type="password"
value={password}
onChange={onChangePassword}
required />
</div>
<div style={{ marginTop: '10px' }}>
<Button type="primary" htmlType="submit" loading={false}>로그인</Button>
<Link href="/signup"><a><Button>회원가입</Button></a></Link>
</div>
</Form>
);
}
LoginForm.propTypes = {
setIsLoggedIn: PropTypes.func.isRequired,
}
export default LoginForm;/* eslint-disable react/jsx-no-undef */
/* eslint-disable no-unused-vars */
import React from 'react';
import Head from 'next/head';
import AppLayout from '../components/AppLayout';
import NicknameEditForm from '../components/NicknameEditForm';
import FollowList from '../components/FollowList';
const Profile = () => {
const followerList = [{ nickname: 'test1' }, { nickname: 'test2' }, { nickname: 'test3' }];
const followingList = [{ nickname: 'test1' }, { nickname: 'test2' }, { nickname: 'test3' }];
return (
<>
<Head>
<title>내 프로필 | NodeBird</title>
</Head>
<AppLayout>
<NicknameEditForm/>
<FollowList header="팔로잉 목록" data={followingList}/>
<FollowList header="팔로워 목록" data={followerList}/>
</AppLayout>
</>
);
};
export default Profile;
넥스트 버젼 질문
0
78
2
로그인시 401 Unauthorized 오류가 뜹니다
0
90
1
무한 스크롤 중 스크롤 튐 현상
0
177
1
특정 페이지 접근을 막고 싶을 때
0
103
2
createGlobalStyle의 위치와 영향범위
0
97
2
인라인 스타일 리렌더링 관련
0
92
2
vsc 에서 npm init 설치시 오류
0
148
2
nextjs 15버전 사용 가능할까요?
0
160
1
화면 새로고침 문의
0
123
1
RTK에서 draft, state 차이가 있나요?
0
155
2
Next 14 사용해도 될까요?
0
452
1
next, node 버전 / 폴더 구조 질문 드립니다.
0
349
1
url 오류 질문있습니다
0
211
1
ssh xxxxx로 우분투에 들어가려니까 port 22: Connection timed out
0
375
1
sudo certbot --nginx 에러
0
1281
2
Minified React error 콘솔에러 (hydrate)
0
470
1
카카오 공유했을 때 이전에 작성했던 글이 나오는 버그
0
248
1
프론트서버 배포 후 EADDRINUSE에러 발생
0
329
1
npm run build 에러
0
519
1
front 서버 npm run build 중에 발생한 에러들
0
383
1
서버 실행하고 브라우저로 들어갔을때 404에러
0
338
2
css 서버사이드 랜더링이 적용되지 않아서 문의 드립니다.
0
289
1
팔로워 3명씩 불러오고 데이터 합쳐주는걸로 바꾸고 서버요청을 무한으로하고있습니다.
0
240
2
해시태그 검색에서 throttle에 관해 질문있습니다.
0
202
1





