Retaining Messages in the State
Keep in mind that every user has an array of 10 messages. When retaining a user's conversation, we only need to obtain the array for that specific user. Also, we will be adding new messages to the array. How do we iterate through the messages? Lodash to the rescue. This will all be implemented in the message reducer.
As we observed in the previous lesson, sending a message returned only an empty string and hence, erased all the contents of the conversation:
Get hands-on with 1400+ tech skills courses.