tarangdave/multithreadchat-react

Suggestions

Opened this issue · 1 comments

From UI / Ux

  1. It would be great to see a relative timestamp next to the chat message.
  2. Implement a presence mechanism to show currently online users.

Technical Feedback

Technical Feedback

  1. frontpage.js Line 22 should be done this way:
editUsername(event) {
    const username = event.target.value;
    this.setState({ username });
}

or persist the event before passing it in the async setState function. Read more here: https://facebook.github.io/react/docs/events.html

  1. Same as [1] here.

  2. You can get rid of empty else block here.

  3. Ideally, you should be making async request (refer this) and manipulating DOM (which should also be improved & managed by react state logic instead of DOM manipulation) in the componentDidMount method. It works in this case only because by the time we get the results, component gets mounted and the chatbox-scroll exists in the DOM.

  4. A better way to create unique ids will be to use libraries like uuid.