hard35 min

Build a Real-Time Chat

Build a chat interface that simulates real-time messaging. The component should auto-scroll to the latest message, support sending messages with Enter key, show typing indicators, and display timestamps. Simulate incoming messages with a timer to emulate a real-time experience.

useStateuseEffectuseRefscroll managementtimers
  • Shows initial welcome message
  • Sends a message when clicking Send
  • Shows typing indicator after sending
  • Bot responds after a delay
  • Sends message with Enter key
Your Code
Loading editor...