JSFiddle - React, Tailwind, and code Playground

by Tân Nguyễn

JavaScript

const topics = [
  {
    topic: "ReactJS",
    posts: [{ postID: "id1", title: "title1" }, { postID: "id2", title: "title2" }]
  },
  {
    topic: "Vue.js",
    posts: [{ postID: "id3", title: "title3" }, { postID: "id4", title: "title4" }]
  }
];

var result = topics.map(x => x.posts).reduce((x,y) => x.concat(y));

console.log(result)