-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
9회차 과제 - 조민서 #5
base: main
Are you sure you want to change the base?
9회차 과제 - 조민서 #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저와 다르게 ui를 잘 구현하셨고, 쿠키를 사용한 방식 잘 보았습니다!! 저도 추후에는 제목과 본문을 같이 업데이트 하는 식으로도 구현해봐야겠습니다. 과제하시느라 수고하셨습니당~~ : )
const moveToHome = (e) => { | ||
e.preventDefault(); | ||
navigate("") | ||
} | ||
|
||
const moveToInfo = (e) => { | ||
e.preventDefault(); | ||
navigate("/info") | ||
} | ||
|
||
const moveToNotice = (e) => { | ||
e.preventDefault(); | ||
navigate("/notice") | ||
} | ||
|
||
const moveToLogin = (e) => { | ||
e.preventDefault(); | ||
navigate("/login") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
클릭하여 navigate하는 기능의 함수를 만들어 한꺼번에 관리를 하는 것이 좋을 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 한꺼번에 관리를 하면 코드가 더 간결해질 것 같습니다~!
const [notices, setNotices] = useState([]); | ||
const [newTitle, setNewTitle] = useState(''); | ||
const [newBody, setNewBody] = useState(''); | ||
const [editingId, setEditingId] = useState(null); | ||
const [editingTitle, setEditingTitle] = useState(''); | ||
const [editingBody, setEditingBody] = useState(''); | ||
const [expandedId, setExpandedId] = useState(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useState({ title: '', body: '' });
이런식으로 title과 body를 한꺼번에 관리해주면 가독성 면에서도 좋을것같습니다~~!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
말씀한대로 한다면 가독성이 더 좋을 것 같습니다. 감사합니다!
const setCookie = (name, value, days) => { | ||
const expires = new Date(Date.now() + days * 864e5).toUTCString(); | ||
document.cookie = `${name}=${encodeURIComponent(value)}; expires=${expires}; path=/`; | ||
}; | ||
|
||
const getCookie = (name) => { | ||
return document.cookie.split('; ').reduce((r, v) => { | ||
const parts = v.split('='); | ||
return parts[0] === name ? decodeURIComponent(parts[1]) : r | ||
}, ''); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저와 다르게 쿠키를 사용하셨네요! 저도 쿠키에 대해 더 공부해봐야겠습니당
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 성임님이 쓰신 방법을 더 공부해봐야겠습니당!
UI
Page Home




Page Info
Page Notice
Page Login
1. 내가 개발한 기능
새로운 공지사항 제목, 내용을 적고 Add Notice 버튼을 클릭하면 공지사항 목록에 추가하는 함수
Save 버튼 클릭 시 공지사항 목록을 업데이트하는 함수
Delete 버튼 클릭 시 공지사항 목록에서 제외하는 함수
.2. 내가 개발할 때 유의깊게 개발한 기능
쿠키를 설정하는 함수인 setCookie, 쿠키를 읽어오는 함수인 getCookie를 구현함
3. 내가 개발하면서 들었던 의문 사항
Notice.jsfmf 컴포넌트로 분리하려고 했으나 props가 너무 많아져 더 복잡해 보였음. 코드를 더 가독성 좋고 간결하게 짤 수 있는 방법에 대하여 고민해봐야 할 것 같음.