0.0.15 • Published 2 years ago

@veritem/useform v0.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

useForm

npm

Tiny hook to use form state in your component.

Usage

import useForm from '@veritem/useform';

export default function App() {
  const { handleChange, inputs, clearForm } = useForm({
    name: '',
    email: '',
    password: '',
  });

  function handleSubmit(e) {
    e.preventDefault();
    console.log(inputs);
  }

  return (
    <section>
      <form onSubmit={handleSubmit}>
        <input
          type="text"
          name="name"
          value={inputs.name}
          onChange={handleChange}
        />
        <input
          type="text"
          name="email"
          value={inputs.email}
          onChange={handleChange}
        />
        <input
          type="text"
          name="password"
          value={inputs.password}
          onChange={handleChange}
        />
        <button type="submit">Submit</button>
      </form>
    </section>
  );
}

License

MIT Licence © 2022 - present veritem

0.0.15

2 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago