post.tsx 748 Bytes
Newer Older
Lee Soobeom's avatar
Lee Soobeom committed
1
import React, { useState, MouseEvent } from "react";
Lee Soobeom's avatar
Lee Soobeom committed
2
import { PostType } from "./typesrc";
3
4
5
6
7
8
9
10

type Props = {
    post: PostType;
}

export default function Post({ post }: Props) {
    const [count, setCount] = useState(0);

Lee Soobeom's avatar
Lee Soobeom committed
11
12
13
14
    // const titleHandleClick = (event:MouseEvent<HTMLButtonElement>) => {
    //     setCount(count + 1)
    // }

15
16
17
    return (
        <div className="flex flex-row h-16 divide-x-2 border-2 border-solid">
            <div className="basis-full">
Lee Soobeom's avatar
Lee Soobeom committed
18
                <button id={post.id} onClick={() => setCount(count + 1)}>{post.title}</button>
19
20
21
22
23
24
            </div> {/*<Link to>title</Link> */}
            <div className="basis-3/12">{post.date}</div>
            <div className="basis-2/12">{count}</div>
        </div>
    );
}