Commit 63a67026 authored by Lee Soobeom's avatar Lee Soobeom
Browse files

button id

parent a172de22
import React, { useState } from "react";
export interface PostType {
id: string;
title: string;
date: string;
click: number;
}
import { PostType } from "./typesrc";
type Props = {
post: PostType;
......@@ -17,7 +11,7 @@ export default function Post({ post }: Props) {
return (
<div className="flex flex-row h-16 divide-x-2 border-2 border-solid">
<div className="basis-full">
<button onClick={() => setCount(count + 1)}>{post.title}</button>
<button id={post.id} onClick={() => setCount(count + 1)}>{post.title}</button>
</div> {/*<Link to>title</Link> */}
<div className="basis-3/12">{post.date}</div>
<div className="basis-2/12">{count}</div>
......
import React, {useState} from "react";
import Post, { PostType } from "./post";
import React, { useState, MouseEvent } from "react";
import { PostType } from "./typesrc";
import Post from "./post";
function range(start:number, end:number) {
return (new Array(end - start + 1)).fill(undefined).map((_, i) => i + start);
......@@ -15,6 +16,10 @@ export default function BoardPage() {
const [posts, setPosts] = useState<PostType[]>(fakes);
// const titleHandleClick = (event:MouseEvent<HTMLButtonElement>) => {
// setPosts( posts)
// }
return (
<div className="flex flex-col items-center">
<div className="flex flex-col items-center mt-6">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment