What I'm trying to do is copy object using object-array with map api.
like below.
decomposite the array inside of an object, and copy.
const obj = [{id: 1, arr: ['a', 'b', 'c']}];
//expected result
const result = [
{id: 1, arr: 'a'},
{id: 1, arr: 'b'},
{id: 1, arr: 'c'},
];
and also setState.
const [obj2, setObj2] = useState([{id: 1, arr: ['a', 'b', 'c']}]);
//Both ways were invalid
//setObj2(...obj2, obj2.arr.map(rr => obj2:rr))
//setObj2(...obj2, obj2.arr : obj2.arr.map(rr => rr))
//expected result
console.log(obj2);
=> [
{id: 1, arr: 'a'},
{id: 1, arr: 'b'},
{id: 1, arr: 'c'},
];
I have no idea how to make it
objis an array with only one element or maybe more?