Skip to content

Instantly share code, notes, and snippets.

@gabrielEloy
Created July 4, 2021 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielEloy/27c4be4c1a9824077104c3e763f246b4 to your computer and use it in GitHub Desktop.
Save gabrielEloy/27c4be4c1a9824077104c3e763f246b4 to your computer and use it in GitHub Desktop.
export default function Auth({ parseQuery }) {
//pre existing functions
const order = (messages) => messages.sort((a, b) => a.get("createdAt") - b.get("createdAt"))
return (
<div className={styles.container}>
<div className={styles.messagesContainer}>
<ul ref={listRef}>
{messages &&
order(messages).map((message, id) => (
<div
key={message.id}
className={messageClassName(message.get("senderId"))}
>
<li className={messageClassName(message.get("senderId"))}>
<span className={messageClassName(message.get("senderId"))}>
{message.get('senderName')}
</span>
<p>{message.get("content")}</p>
</li>
</div>
))}
</ul>
</div>
<form onSubmit={handleSubmitMessage} className={styles.actionsContainer}>
<input value={inputMessage} onChange={handleupdateInput} />
<button>send message</button>
</form>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment