You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ALL of the included samples use hardcoded messages and converstations.
I am struggling to get a real-life example on how to get the data from an array of converstations.messages to appear in the components.
Here is an example of getting the messages out and putting them in the MessageList.
This is the DOM to display the Chat Dialog (converstations are hardcoded for now, as I suspect the same method for getting them from an array would be simular to how it would be done for messages):
Please also don't use a second argument (index) of the map method as key in a list. It's not good practice. React documentation says: "We don’t recommend using indexes for keys if the order of items may change. This can negatively impact performance and may cause issues with component state" Read more here: https://reactjs.org/docs/lists-and-keys.html#keys
To generate a unique id you can use the wonderful https://github.com/ai/nanoid library. But be careful theirs react example is not quite good ;)
I'll try to prepare some new examples in the documentation.
ALL of the included samples use hardcoded messages and converstations.
I am struggling to get a real-life example on how to get the data from an array of converstations.messages to appear in the components.
Here is an example of getting the messages out and putting them in the MessageList.
This is the DOM to display the Chat Dialog (converstations are hardcoded for now, as I suspect the same method for getting them from an array would be simular to how it would be done for messages):
I want this to product the MessageList:
Messages are formatted here
The text was updated successfully, but these errors were encountered: