Can I make this more efficient without having to do two call to getPosts ? I want to use the initial posts to create different layout but i dont want to keep using getPosts() or is that juts not possible ?
import { getPosts } from "../../sanity-utils"
export default async function Server() {
const posts = await getPosts();
return (
<div className="">
{posts.map((post) => (
<div key={post.id } className="">
<h1>{post.title}</h1>
<img src={post.image} alt="image" className="w-1/3 "/>
</div>
))}
</div>
);
}
export async function Card() {
const posts = await getPosts();
return (
<div className="">
{posts.map((post) => (
<div key={post.id } className="flex">
<h1>{post.title}</h1>
<img src={post.image} alt="image" className="w-1/3 "/>
</div>
))}
</div>
);
}