Strange react-native state behaviour while using socket io
问题 Hi currently im trying to create a simple group chat apps. when i use this on useEffect useEffect(() => { // i want to fetch data from the backend first and concat it with the msg that will be send during the chat handleGetGroupMessage(); let socket = io(socketUrl); socket.on("GroupChat", (msg) => { console.log("this is the chat messages", chatMessages); setChatMessages(chatMessages.concat(msg)); }); }, []); when the apps is loaded all the messages from my backend was stored in that state.