I'm looking to make a react counter with target character count for a textarea just like Twitter's does, which reduces as the user types.
For example, on the Meta Description field, the target character count is 160. So, if the field is blank, the number would be 160. As the user types, the count is decreased with each character added to the input field until it reaches zero.
If the count is higher than the target, the numbers are written in red with a minus sign in front (again, just like twitter).
One way to do this is the listen to the onChange event on the textarea, and update the state of the component (which has the textarea and the counter), and then use that to calculate length and render the remaining char counter.
Is there a more efficient way?