Skip to content

Instantly share code, notes, and snippets.

@matefs
Created January 22, 2023 19:15
Show Gist options
  • Save matefs/3c63b289656ad6a9ccfb21dee9a8daad to your computer and use it in GitHub Desktop.
Save matefs/3c63b289656ad6a9ccfb21dee9a8daad to your computer and use it in GitHub Desktop.
Página de cadastro React.js

Página de Cadastro (Name, Email, CPF, Birthday, Sex, City , State, Password, Confirm Password)

import React, { useState } from 'react';

const RegisterPage = () => {
  const [name, setName] = useState('');
  const [email, setEmail] = useState('');
  const [cpf, setCpf] = useState('');
  const [birthday, setBirthday] = useState('');
  const [sex, setSex] = useState('');
  const [city, setCity] = useState('');
  const [state, setState] = useState('');
  const [password, setPassword] = useState('');
  const [confirmPassword, setConfirmPassword] = useState('');

  const handleSubmit = (e) => {
    e.preventDefault();
    // Your code for handling the form submission here
  }

  return (
    <form onSubmit={handleSubmit}>
      <label>
        Name
        <input type="text" value={name} onChange={e => setName(e.target.value)} />
      </label>
      <label>
        Email
        <input type="email" value={email} onChange={e => setEmail(e.target.value)} />
      </label>
      <label>
        CPF
        <input type="text" value={cpf} onChange={e => setCpf(e.target.value)} />
      </label>
      <label>
        Birthday
        <input type="date" value={birthday} onChange={e => setBirthday(e.target.value)} />
      </label>
      <label>
        Sex
        <select value={sex} onChange={e => setSex(e.target.value)}>
          <option value="male">Male</option>
          <option value="female">Female</option>
        </select>
      </label>
      <label>
        City
        <input type="text" value={city} onChange={e => setCity(e.target.value)} />
      </label>
      <label>
        State
        <input type="text" value={state} onChange={e => setState(e.target.value)} />
      </label>
      <label>
        Password
        <input type="password" value={password} onChange={e => setPassword(e.target.value)} />
      </label>
      <label>
        Confirm Password
        <input type="password" value={confirmPassword} onChange={e => setConfirmPassword(e.target.value)} />
      </label>
      <input type="submit" value="Submit" />
    </form>
  );
}

export default RegisterPage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment