We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ff62df7 commit d28262aCopy full SHA for d28262a
src/useTextAnalyzer.ts
@@ -16,8 +16,13 @@ function useTextAnalyzer({
16
trimText = true,
17
wordsPerMinute,
18
}: TextAnalyzerOptions): TextAnalysisResult {
19
- const processedText = trimText ? text.trim() : text;
20
- const effectiveWPM = determineReadingSpeed(processedText, wordsPerMinute);
+ const processedText = useMemo(() => {
+ return trimText ? text.trim() : text;
21
+ }, [text, trimText]);
22
+
23
+ const effectiveWPM = useMemo(() => {
24
+ return determineReadingSpeed(processedText, wordsPerMinute);
25
+ }, [processedText, wordsPerMinute]);
26
27
const analysisResult = useMemo(() => {
28
return calculateStats({
0 commit comments