I have the following state object
campaigns : [
{
id : 1,
active: false,
....other key value pairs
},
{
id : 2,
active: false
....other key value pairs
},
{
id : 3,
active: false
....other key value pairs
}
]
My api gives me a response of the campaign id (say for example 2) how do i change the active flag to true in the campaigns array without mutating it or using a library. Es6 or just plain JS. Any help would be good.
I am using just react and react router.. not redux as yet.