score:1

Accepted answer

You can use map method to map thought the array and change the status to true.

  useEffect(() => {
    if (message) { 
    const newMessages = messages?.map((mess) => {
        return {...mess, status: true}})
      setCurrentMessage(newMessages);
    }}, [message]);

score:1

Set the mapped state with useEffect

useEffect(() => {
  const data = [...message];
  if (data.length > 0) {
    data.map((ele) => ({
      value: "YOUR CHANGED VALUE",
      status: ele.status,
    }));
    setCurrentMessage(data);
  }
}, [message]);


Related Query

More Query from same tag