mirror of
https://github.com/khairul169/code-share.git
synced 2025-04-28 16:49:36 +07:00
26 lines
460 B
TypeScript
26 lines
460 B
TypeScript
import type { Data } from "./+data";
|
|
import { useData } from "~/renderer/hooks";
|
|
import Link from "~/renderer/link";
|
|
|
|
const HomePage = () => {
|
|
const { posts } = useData<Data>();
|
|
|
|
if (!posts?.length) {
|
|
return <p>No posts.</p>;
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<h1>Posts</h1>
|
|
|
|
{posts.map((post: any) => (
|
|
<Link key={post.id} href={`/${post.id}`}>
|
|
{post.title}
|
|
</Link>
|
|
))}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default HomePage;
|