import React, { useState } from 'react'; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; export default function CommunityBoard() { const [posts, setPosts] = useState([ { id: 1, author: "Hemin", content: "안녕하세요! 게시판 첫 글입니다 :)" }, ]); const [newPost, setNewPost] = useState(""); const [author, setAuthor] = useState(""); const handlePost = () => { if (!newPost || !author) return; const post = { id: posts.length + 1, author: author, content: newPost, }; setPosts([post, ...posts]); setNewPost(""); setAuthor(""); }; return (

📝 커뮤니티 게시판

setAuthor(e.target.value)} /> setNewPost(e.target.value)} />
{posts.map((post) => (

{post.author}

{post.content}

))}
); }