JSFiddle - React, Tailwind, and code Playground

by Pritesh Patel

JavaScript

const array = [{
    "name": "covidMessage",
    "value": "Be careful, there is covid"
  },
  {
    "name": "convidFeature",
    "value": "false"
  }
]

const testArr = array.reduce((accumulator, currentValue) => {
	accumulator[currentValue.name] = currentValue.value
  return accumulator
},{})

console.log("testArr: ", testArr);