Skip to content

Commit 21e65fe

Browse files
BartoszKlonowskineighborhood999
authored andcommitted
Use 'trim()' method in useContext page to prevent form from accepting whitespaces (#6549)
1 parent 5024537 commit 21e65fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/reference/react/useContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ function LoginForm() {
457457
const {setCurrentUser} = useContext(CurrentUserContext);
458458
const [firstName, setFirstName] = useState('');
459459
const [lastName, setLastName] = useState('');
460-
const canLogin = firstName !== '' && lastName !== '';
460+
const canLogin = firstName.trim() !== '' && lastName.trim() !== '';
461461
return (
462462
<>
463463
<label>

0 commit comments

Comments
 (0)