So far you have created some static markdown to display chat messages and an input box in the UI. Next you are going to implement the useState()
hook in React to store the chat messages in an array in memory
const [ value, setValue ] = useState<string[]>(['item', 'item']);
Message
for your messages. The type should declare two fields called text
and sender
. useState()
hook to save an array of messages, where each message is an object of your new Message
type. useState()
hook to an array of sample message objects containing test data.<p>
components.