JSFiddle - React, Tailwind, and code Playground

JavaScript

var arr = [
{
'id': 1,
'text': 'ab'
},{
'id': 1,
'text': 'cd'
}, {
'id': 2,
'text': 'other'
}, {
'id': 3,
'text': 'afafas'
}, {
'id': 4,
'text': 'asfasfa'
}
];

var work = arr.reduce(function (p, c) {
var key = c.id;

p[key].text.push(c.text);
});

console.log(work);