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.

+ )} +
+ ); +}