const state = [
{
userId: 1,
name: "JSSnippets",
isOwner: false,
},
{
userId: 2,
name: "React",
isOwner: false,
},
{
userId: 3,
name: "Vue",
isOwner: false,
},
{
userId: 4,
name: "Angular",
isOwner: false,
},
];
const newState = state.map((obj) =>
obj.name === "JSSnippets" ? { ...obj, isOwner: true } : obj
);