Submit messages

Easy
5
53.3% Acceptance

You’re presented with a component called MessageFeed. This component has already been designed. Your task is to write the necessary logic to make it work as expected.
MessageFeed displays a feed box with past messages. Below the feed box, you can find an input element where the user can type in their message. Add the necessary code to append the user message to the existing message feed when the user presses Shift + Enter on their keyboard.
image

Instructions

  • You don’t need to worry about styling your application as we have already done it for you. But if you wish to update the styles, you can use styled-components, inline style or tailwindcss.
  • Do not edit the data-testid attributes.
  • You only need to add the message submission logic.
  • Do not let users submit empty messages.

Hints

  • You should add a keydown event listener that’s always listening for the Shift + Enter combination being pressed. If that’s the case then execute a relevant callback to append the message to the feed.