Skip to content

Commit e2600ff

Browse files
Stijn de Ligtugogo
andauthored
fix: code consistency
Co-authored-by: Ugo Onali <ugo.j.onali@gmail.com>
1 parent 1ef3ec6 commit e2600ff

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,11 @@ const ReactInputVerificationCode = ({
139139
}, []);
140140

141141
React.useEffect(() => {
142-
const stringValue = value.join('')
142+
const stringValue = value.join('');
143+
const isCompleted = !stringValue.includes(placeholder);
143144

145+
if (isCompleted) onCompleted(stringValue);
144146
onChange(stringValue);
145-
146-
if (!stringValue.includes(placeholder)) {
147-
onCompleted(stringValue)
148-
}
149147
}, [value]);
150148

151149
React.useEffect(() => {

0 commit comments

Comments
 (0)