Finzie

Blog 4

blog-4

7. {console.log(post.desc)}:

  • This logs the desc (description) field of each blog post to the console for debugging purposes. It helps you verify that the data is coming in as expected.

8. <p>{post.desc}</p>:

  • This renders the blog post's description in a paragraph. post.desc refers to the desc field from your blog post schema, which is usually a short summary or description of the post.

Summary:

  • map() is looping through each blog post and generating a JSX structure for it.
  • post.slug.current is the unique part of the blog post's slug, used as a key for React's list rendering.
  • urlForImage() is a helper function to build the correct image URL from Sanity data.
  • The JSX structure is used to display the title, main image, author, and description of each blog post.

© 2024 Finzie.

Lets start building your
success story today.