2.6.2021 |

React Hook Form

React Hook Form ist eine Form library für React. https://react-hook-form.com/

import React from "react";
import { useForm } from "react-hook-form";

export default function App() {
  const { register, handleSubmit } = useForm();
  const onSubmit = data => console.log(data);
   
  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <input {...register("firstName", { required: true, maxLength: 20 })} />
      <input {...register("lastName", { pattern: /^[A-Za-z]+$/i })} />
      <input type="number" {...register("age", { min: 18, max: 99 })} />
      <input type="submit" />
    </form>
  );
Lucas Meurer
Zur Übersicht

Mehr vom DevSquad...

Simon Jakubowski

HowTo Query Optimization

sepideh adelpour

Aframe (3D Room)