Ask coding questions

← Back to all posts
How to display two different formats of messages to users
Xenity (9)

So, me and @A1PHA1 are working on a chatting app and we need to display 2 different bubbles for our chat because right now all messages are the same. So what we want to do is show a blue one for the local user and a gray one for other users (on each device so client 1 will see their messages blue and other's messages gray, so will the rest of the clients) but we don't know how to implement that so yeah.. All help is appreciated (link to repl:

Answered by Coder100 (18123) [earned 5 cycles]
View Answer
Coder100 (18123)


remember how whenever you send a message you also send a bit of info about who sent the message?

You could do that to compare if the user sent the message or not, and css accordingly.

Coder100 (18123)

Mark as correct answer? @A1PHA1