RegisterPage.jsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { useState } from 'react';
  2. import { Link } from 'react-router-dom';
  3. import { history } from '../App';
  4. import '../App.css';
  5. export const RegisterPage = ({ onRegister }) => {
  6. const [loginReg, setLoginReg] = useState("");
  7. const [passwordReg, setPasswordReg] = useState("");
  8. const Registration = () => {
  9. onRegister(loginReg, passwordReg)
  10. setLoginReg('')
  11. setPasswordReg('')
  12. }
  13. return (
  14. <div className="formBlock">
  15. <h1>Регистрация</h1>
  16. <div className="mb-3">
  17. <label htmlFor="exampleInputEmail1" className="form-label">Enter Login</label>
  18. <input
  19. type="text"
  20. value={loginReg}
  21. onChange={(e) => setLoginReg(e.target.value)}
  22. className="form-control"
  23. id="exampleInputEmail1"
  24. aria-describedby="emailHelp" />
  25. </div>
  26. <div className="mb-3">
  27. <label htmlFor="exampleInputPassword1" className="form-label">Enter Password</label>
  28. <input
  29. type="password"
  30. value={passwordReg}
  31. onChange={(e) => setPasswordReg(e.target.value)}
  32. className="form-control"
  33. id="exampleInputPassword1" />
  34. </div>
  35. <div className="mb-3">
  36. <button type="submit" className="btn btn-primary" onClick={Registration}>Зарегистрироваться</button>
  37. </div>
  38. <Link to="/login">Я уже зарегистрирован</Link>
  39. </div>
  40. )
  41. }