I use React and I have this array in Redux Persist reducer:
const data = [["2020-09-14","15:00","60","Info","April Tucker","Other","yes"],
["2020-09-14","2:00","50","Text","April Tucker","Other","yes"]]
I want to return a new array of objects (for each array in the array) with some of the values from the data array. Example of how it should look like:
let events = [{ title: data[0][3], date: data[0][0] },{ title: data[1][3], date: data[1][0]}]
I tried to use array.map method:
let events [
data.map((index) => ({
title: data[index][3],
date: data[index][0],
})),
]
This does not work as I expected. How to do it properly?