Skip to content

a library to help in converting form inputs to object

Notifications You must be signed in to change notification settings

irumvanselme/submitHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

submitHandler

This package is used to help react and vue developers to be able to access information in the form at ease.

Instalation

yarn add submithandler or npm install submithandler

Usage

import { submitHandler } from "submithandler"

export function MyComponent(){

  async function register(data){
    /**
     * data's schema is {
     *  login: "",
     *  password: ""
     * }
     * 
     * You can use data.login to access data submitted in form on login input as well as data.password
     */
  }

  return (
    <form onSubmit={submitHandler(register)}>
      <input name="login" placeholder="eg: username" />
      <input name="password" placeholder="***" />
    </form>
  )
}

Implementation

The Object parsed to your function is constructed from the formula of keys as input names and values as input values.

About

a library to help in converting form inputs to object

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published