Build a <textarea> with a live character counter as a single React component. A message box capped at 200 characters shows 0 / 200 and updates on every keystroke, and once you get within 20 of the limit the counter turns red to warn you. It's a classic controlled-input exercise: one piece of state (the text) drives both the box and everything derived from it.
The starter App.tsx renders the textarea in its empty state with the counter reading 0 / 200. Make it live:
useState('').value={text} and update it in onChange so the text is a controlled input.count = text.length, show count / 200 in the counter, and add the near class when count >= 180 so it turns red.0 / 200 below it. Typing "hello" updates the counter to 5 / 200.#ef4444) as an at-the-limit warning; deleting back under 180 turns it grey again.maxlength="200" on the textarea hard-stops input at 200, so the counter never exceeds 200 / 200.text.length — don't track a separate count state that can drift.maxLength is the hard stop; the counter is the soft warning. The attribute prevents overflow; the red colour is a courtesy that starts 20 characters early.value + onChange keeps React's state and the DOM in sync — that's what lets you read text.length reliably.styles.css; focus on the state.