From 71bfbb262ceca545e7d65e5b1fef5482b72e5d5b Mon Sep 17 00:00:00 2001 From: Arjun Singh Saluja Date: Fri, 3 Oct 2025 12:51:25 +0530 Subject: [PATCH] docs(example): add Next.js blog example page using usePosts hook --- test-projects/next/pages/blog.tsx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test-projects/next/pages/blog.tsx diff --git a/test-projects/next/pages/blog.tsx b/test-projects/next/pages/blog.tsx new file mode 100644 index 000000000..20ef62f7c --- /dev/null +++ b/test-projects/next/pages/blog.tsx @@ -0,0 +1,30 @@ +import React from "react"; +import { usePosts } from "@headstartwp/next"; // hook from headstartwp + +export default function BlogPage() { + const { data, isLoading, error } = usePosts({ + perPage: 5, + }); + + if (isLoading) return

Loading posts...

; + if (error) return

Failed to load posts.

; + + return ( +
+

Latest Blog Posts

+ {data?.posts?.length ? ( + + ) : ( +

No posts found.

+ )} +
+ ); +}