title: override existing objects when push into an array - replace or add
body: <p>suppose we try to connect web socket. web socket server sends some data for fetching client status which represents the online or offline. I tried to store these data into redux (works fine), but I need to change these statuses instantly with overriding the existing objects. I need some functionality for override my redux store. I get so far with the snippet below.</p>
  
  <p>but:</p>
  
  <blockquote>
    <p>this code push objects to my redux store not overriding</p>
  </blockquote>
  
  <pre><code>  const [status, set_status] = useState([]);
  
    useEffect(() =&gt; {
      const socket = io(ws_api, {
        query: `token=${localStorage.getItem("token")}`,
      });
  
      socket.on("message", (data) =&gt; {
  
        status.map((item) =&gt; {
          if (item.application === data.application) {
            item["status"] = data.status;
          } else {
            set_status((status) =&gt; [...status, data]);
          }
        });
  
      });
    }, []);
  
    useEffect(() =&gt; {
      get_client_status(status); // redux action
    }, [status]);
  
  </code></pre>
  
  <p>the data structure which is coming from the socket on message</p>
  
  <pre><code>{
    application: "5ede25f4d3fde1c8a70f0a38"
    client: "5ede25f4d3fde1c8a70f0a36"
    status: "offline"
  }
  </code></pre>