1.0.0 • Published 1 year ago

react-fieldsafe v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@ React FieldSafe

Just an abstraction of the FieldSafe package for React.js

Library to assist in the development of security for form fields, with validation by RegEx, Sanitization and Mask in inputs.

Installation

npm:

$ npm install react-fieldsafe

yarn:

$ yarn add react-fieldsafe

Usage:

import { useState } from 'react';
import { Validation } from 'react-fieldsafe';

export default function App() {
  
  const [email, setEmail] = useState('guest@test.com');

  const submitForm = (e) => {
    e.preventDefault(); 
    
    const validator = new Validation();
    const isEmail = validator.email(email);

    console.log(isEmail) // true
  }

  return (
    <div className="app">
      <h1>React FieldSafe</h1> 

      <form method="POST" onSubmit={submitForm}>

        <input 
          type="text" 
          onChange={(e) => setEmail(e.target.value)} 
        />
        
        <button>Submit</button>

      </form>

    </div>
  );
};

Other concepts and examples will be discussed in this project's Wiki.

1.0.0

1 year ago