I have an array of categories. Categories can have some tasks and I want to count the number of tasks.
const categories = [
{
id: 1,
icon: '⚒️',
name: 'work',
color: 'bg-[#F8A94B]',
tasks: [
{ id: 1, description: 'Do A', completed: true },
{ id: 2, description: 'Do B', completed: false },
{ id: 3, description: 'Do C', completed: false },
{ id: 4, description: 'Do D', completed: true },
{ id: 5, description: 'Do E', completed: false },
{ id: 6, description: 'Do F', completed: true },
],
},
{
id: 2,
name: 'home',
icon: '