How to Fetch Posts by category?

Hello,
i want to fetch post for three differnet categroies at my home page , so what is best way to do it,
my design looks like below ,

Hello @mehul

Please take a look at this example that @juanma has created:

1 Like

if you want to show the posts ordered by date, you have to modify the helper:

...
export const getPostsGroupedByCategory = state => {
  return Object.keys(state.theme.menuCategories).reduce((acc, categoryId) => {
    const posts = getPostsFromCategory(state.source, categoryId)
      .sort((a, b) => a.date < b.date ? 1 : -1)
      .slice(0, 4)
    const category = state.source.category[categoryId]
    return [{ posts, category }, ...acc]
  }, [])
}
...