Skip to the content.

Log 25 - 22/04/2022

After getting chat working pretty quickly yesterday, today I spent my time moving the chat functions too React, this was a lot more straightforward than the grid. I just had to add the message listener in the room ID useEffect hook and store the messages in a stateful array. Deciding how the messages should be stored in the array took some time, I’ve just decided to hold the actual span elements to be rendered rather than just holding the data and constructing each message after the fact. This approach may be more useful if I had a separate React component for messages, but not in this case. I did make a giant nested Styled Component for most of the grid area, which is probably not the best approach but the styling for the message area was made a lot simpler this way and I was able to get chat fully functioning in React as it was before.

Prev Next