Simple Registration Form for Meteor written in React/Typescript

The minimal working example to sign up a user with meteor accounts-password and react.js

The bare minimum to get started with meteor accounts-password in typescript/react (TSX).

This is the sign up form to register a new user with a password. See the sign in form for the complementary login snippet.

import { Accounts } from 'meteor/accounts-base';
import React, { useState } from 'react';

export const RegisterForm = () => {
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');

  const submit = (e: React.FormEvent) => {
    e.preventDefault();
    Accounts.createUser({ email, password });
  };

  return (
    <form onSubmit={submit} className="login-form">
      <label htmlFor="email">Email</label>

      <input
        type="text"
        placeholder="Email"
        name="email"
        required
        onChange={e => setEmail(e.target.value)}
      />

      <label htmlFor="password">Password</label>

      <input
        type="password"
        placeholder="Passwort"
        name="password"
        required
        onChange={e => setPassword(e.target.value)}
      />

      <button type="submit">Register</button>
    </form>
  );
};

Technologies: