Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kiran-varma-home-office committed Nov 21, 2024
1 parent 15fd32f commit e6cfd0e
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/text-area-word-count/wordcount-hint-message.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ import React from 'react';

const WordCountHintMessage = ({ content, id, maxWordCount = 0 }) => {

const wordCount = content?.split(/\s+/).filter(Boolean).length;

const wordCount = content?.split(/\s+/).filter(Boolean).length ?? 0;
const hintId = `${id}-wordcount-hint`;

let hintText = '';

if (!wordCount && maxWordCount) {
hintText = `You have ${maxWordCount} words remaining`;
}

const wordCountText = count => count === 1 ? 'word' : 'words';

if (wordCount > maxWordCount) {
Expand Down

0 comments on commit e6cfd0e

Please sign in to comment.