JSFiddle - React, Tailwind, and code Playground
by Eugen Sunic
JavaScript
const bigData = [{
category: 'swim',
value: 'Abc'
},
{
category: 'ran',
value: ''
},
{
category: 'play',
value: 'abc'
}
]
const searchString = 'String th';
const res = bigData.reduce((acc, x, i) => {
return {
...acc,
[i]: x
}
}, {});
console.log(res)