intopost.tsx 910 Bytes
Newer Older
Yoon, Daeki's avatar
Yoon, Daeki committed
1
2
3
import React from "react";
import { useLocation } from "react-router-dom";
import { PostType } from "../types";
Lee Soobeom's avatar
Lee Soobeom committed
4
5

interface PostState {
Yoon, Daeki's avatar
Yoon, Daeki committed
6
  state: PostType;
Lee Soobeom's avatar
Lee Soobeom committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
}

export function IntoPost() {
  const location = useLocation() as PostState;
  const post = location.state;
  // console.log(post);

  return (
    <div>
      <div>
        <div className="flex flex-row">
          <div className="flex basis-3/4">제목: {post.title}</div>
          <div className="flex basis-1/4">작성자: nickname</div>
        </div>
        <div className="flex flex-row">
          <div className="flex basis-1/4">도시: {post.city}</div>
          <div className="flex basis-1/4">테마: {post.theme}</div>
          <div className="flex basis-1/4">작성일: {post.date}</div>
          <div className="flex basis-1/4">조회수: {post.counts}</div>
        </div>
      </div>
      <div>{post.text}</div>
    </div>
  );
}