type Serpent = {
info: {
id: string;
isChosen: boolean;
shade: string;
}[],
setChosenStatus:(prevInfo:{id:string, isChosen:boolean, shade:string}, isChosen:boolean) => void
}
export const useSerpent = create<Serpent>((set) => ({
info:[
{id:'1', isChosen:false, shade:''},
{id:'2', isChosen:false, shade:''},
{id:'3', isChosen:false, shade:''},
{id:'4', isChosen:false, shade:''},
{id:'5', isChosen:false, shade:''},
{id:'6', isChosen:false, shade:''},
{id:'7', isChosen:false, shade:''},
{id:'8', isChosen:false, shade:''},
{id:'9', isChosen:false, shade:''},
{id:'10', isChosen:false, shade:''},
{id:'11', isChosen:false, shade:''},
{id:'12', isChosen:false, shade:''},
{id:'13', isChosen:false, shade:''},
{id:'14', isChosen:false, shade:''},
{id:'15', isChosen:false, shade:''},
{id:'16', isChosen:false, shade:''}
],
setChosenStatus:(prevInfo:{id:string, isChosen:boolean, shade:string}, toToggle:boolean) => {
}
}))
i am trying to locate the object that matches prevInfo within the setChosenStatus properties and update its isChosen value with the toToggle property. However, I am uncertain about how to implement a map function inside the set() method.