12345678910111213141516171819 |
- import React, {useState} from "react";
- export const LoginForm = () => {
- const [login, setLogin] = useState('')
- const [password, setPassword] = useState('')
- const onLogin = () => {
- return !(login !== '' && password.match(/^[A-Za-z]\w{5,10}$/));
- }
- return (
- <>
- <div className="loginBox">
- <input type="text" value={login} onChange={(e) => setLogin(e.target.value)}/>
- <input type="password" value={password} onChange={(e) => setPassword(e.target.value)}/>
- <button disabled={onLogin()}>Log In</button>
- </div>
- </>
- )
- }
|