Ver código fonte

HW <20 fixed> done

Illia Kozyr 1 ano atrás
pai
commit
7cb3d2c282
1 arquivos alterados com 7 adições e 2 exclusões
  1. 7 2
      REACT/HW 20/src/App.js

+ 7 - 2
REACT/HW 20/src/App.js

@@ -7,8 +7,13 @@ const LoginForm = () => {
     const [password, setPassword] = useState("");
 
     const onLogin = () => {
-        return !(login !== "" && password.match(/\w{8,30}$/));
+        return !(login !== "" && password.match(/\w{8,30}$/))
     };
+
+    const Authorization = () => {
+        return alert("Welcome, authorization was successful")
+    }
+
     return (
         <div className="formBlock">
             <p>Enter login:</p>
@@ -24,7 +29,7 @@ const LoginForm = () => {
                 value={password}
                 onChange={(e) => setPassword(e.target.value)}
             />
-            <button disabled={onLogin()}>Log In</button>
+            <button disabled={onLogin()} onClick = {Authorization}>Log In</button>
         </div>
     );
 };