Skip to content
Snippets Groups Projects
Commit fc30df1c authored by Jaeyong Lee's avatar Jaeyong Lee
Browse files

Add Post.js

parent 37626209
No related branches found
No related tags found
No related merge requests found
/*
title: {
type: String,
required: true,
},
articleId: {
type: String,
unique: true,
},
content: {
type: String,
required: true,
},
imageUrls: {
type: [String],
},
author: {
type: UserSchema,
required: true,
},
comments: {
type: [CommentSchema],
},
likes: {
type: [UserSchema],
},
createdAt: {
type: Date,
default: Date.now,
},
});
*/
import React, {useEffect, useState} from "react";
import { useParams } from 'react-router-dom';
function Post() {
const [post, setPost] = useState(null);
const { id } = useParams(); // URL에서 id를 가져온다./-> articleId
useEffect(() => {
// id를
// 예시: fetchPost(id).then(data => setPost(data));
}, [id]);
if (!post) {
return <div>Loading...</div>;
}
return (
<div>
<h1>{post.title}</h1>
<h2>{post.author}</h2>
<p>{post.content}</p>
{/* 게시글의 내용을 렌더링합니다. */}
</div>
);
}
export default Post;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment