diff --git a/job1/src/Community/Write.js b/job1/src/Community/Write.js new file mode 100644 index 0000000..e69de29 diff --git a/job1/src/View/Write.js b/job1/src/View/Write.js index 7b8e72a..9c1957b 100644 --- a/job1/src/View/Write.js +++ b/job1/src/View/Write.js @@ -1,5 +1,66 @@ + +import { useState } from "react"; +import { useNavigate, useLocation } from "react-router-dom"; + function Write() { - return
Write
; + const [post, setPost] = useState({ + title: '', + content: '', + author: '', + likes: '0' + }); + + const { title, content, author, likes } = post; + + const onChange = (e) => { + const { name, value } = e.target; + setPost({ + ...post, + [name]: value, + }); + }; + + const navigate = useNavigate(); + const submit = (e) => { + e.preventDefault(); + alert('등록되었습니다!'); + navigate('/community'); + console.log(post); + }; + + const cancel = () => { + navigate(`/community`); + }; + + return ( +
+
+

글쓰기

+
+ + +
+
+

태그 선택

+
+ {/* 태그 */} +
+ + +
+
+ ); } export default Write;