'[Vue warn]: Error in render: "TypeError: visitor.messages is undefined"

I have a parent table in laravel, I am able to access the data of its child in vuejs i.e the parent table visits and its child is messages so to access the messages for each visit, first I am looping through the visits and each visit accessing the messages.

Since it's a real-time app (i am using laravel echo and laravel WebSockets), I want when someone else on the system sends a message, the received message to be pushed to the already existing array.

This is the code that's supposed to push incoming messages

this.visitors.push(event['message'])

if I console

console.log(event['message'].message) 

I am getting the exact message I have sent. This is the error I am getting

[Vue warn]: Error in render:  "TypeError: visitor.messages is undefined". 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source