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

button id

parent a172de22
import React, { useState } from "react"; import React, { useState } from "react";
import { PostType } from "./typesrc";
export interface PostType {
id: string;
title: string;
date: string;
click: number;
}
type Props = { type Props = {
post: PostType; post: PostType;
...@@ -17,7 +11,7 @@ export default function Post({ post }: Props) { ...@@ -17,7 +11,7 @@ export default function Post({ post }: Props) {
return ( return (
<div className="flex flex-row h-16 divide-x-2 border-2 border-solid"> <div className="flex flex-row h-16 divide-x-2 border-2 border-solid">
<div className="basis-full"> <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> {/*<Link to>title</Link> */}
<div className="basis-3/12">{post.date}</div> <div className="basis-3/12">{post.date}</div>
<div className="basis-2/12">{count}</div> <div className="basis-2/12">{count}</div>
......
import React, {useState} from "react"; import React, { useState, MouseEvent } from "react";
import Post, { PostType } from "./post"; import { PostType } from "./typesrc";
import Post from "./post";
function range(start:number, end:number) { function range(start:number, end:number) {
return (new Array(end - start + 1)).fill(undefined).map((_, i) => i + start); return (new Array(end - start + 1)).fill(undefined).map((_, i) => i + start);
...@@ -12,8 +13,12 @@ interface Posts { ...@@ -12,8 +13,12 @@ interface Posts {
} }
export default function BoardPage() { export default function BoardPage() {
const [posts, setPosts] = useState<PostType[]>(fakes);
const [posts, setPosts] = useState<PostType[]>(fakes); // const titleHandleClick = (event:MouseEvent<HTMLButtonElement>) => {
// setPosts( posts)
// }
return ( return (
<div className="flex flex-col items-center"> <div className="flex flex-col items-center">
......
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