FormReg.js 1.0 KB

123456789101112131415161718
  1. import React, {useState} from "react";
  2. import "./LoginReg.css";
  3. export const FormReg = ({FormReg}) => {
  4. const [login, setLogin] = useState('')
  5. const [password, setPassword] = useState('')
  6. const [passwordValid, setPasswordValid] = useState('')
  7. return (
  8. <div className='login'>
  9. <h3>Registration</h3>
  10. <input className='u'type ='login' placeholder='Username' value = {login} onChange = {e => setLogin(e.target.value)}/>
  11. <input className='p' type ='password' placeholder='Password' value = {password} onChange = {e => setPassword(e.target.value)} />
  12. <input className='p' type ='password' placeholder='RepeatYourPassword' value = {passwordValid} onChange = {e => setPasswordValid(e.target.value)} />
  13. <button type="submit" className='btn btn-primary btn-block btn-large' disabled = {!login || !password || (password !== passwordValid)} onClick = {() => FormReg(login, password)}>Remember me. </button>
  14. <button className='main_page'><a href = '/'>Main page</a></button>
  15. </div>
  16. )
  17. }