intopost.tsx 1.02 KB
Newer Older
Lee Soobeom's avatar
Lee Soobeom committed
1
2
3
4
5
6
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
32
33
34
35
36
37
38
39
import React, { useState } from "react";
import { useLocation, useParams } from "react-router-dom";

interface PostState {
  state: {
    title: string;
    text: string;
    theme: string;
    city: string;
    date: string;
    counts: number;
    _id: string;
    user: string;
  };
}

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>
  );
}