Leaflet Blog in Deno Fresh
1import { useSignal } from "@preact/signals"; 2import { useEffect } from "preact/hooks"; 3import { PostListItem } from "../components/post-list-item.tsx"; 4 5interface PostRecord { 6 value: any; 7 uri: string; 8} 9 10export default function PostList( 11 { posts: initialPosts }: { posts: PostRecord[] }, 12) { 13 const posts = useSignal(initialPosts); 14 15 useEffect(() => { 16 posts.value = initialPosts; 17 }, [initialPosts]); 18 19 return ( 20 <> 21 {posts.value?.map((record) => { 22 const post = record.value; 23 const rkey = record.uri.split("/").pop() || ""; 24 return ( 25 <PostListItem 26 key={record.uri} 27 post={post} 28 rkey={rkey} 29 /> 30 ); 31 })} 32 </> 33 ); 34}