JSFiddle - React, Tailwind, and code Playground
JavaScript
var cols = [{
id: 1,
title: 'First Column',
tasks: []
}, {
id: 2,
title: 'Second Column',
tasks: []
}, {
id: 3,
title: 'Third Column',
tasks: []
}];
var tasks = [{
id: 1,
title: 'Bla bla project',
column: 1
}, {
id: 2,
title: 'Hip Hop project',
column: 1
}];
cols.map(function(col) {
col.tasks = tasks.filter(function(task) {
return task.column == col.id;
});
});
console.log(cols);