1.0.7 • Published 2 months ago

auth-form-react v1.0.7

Weekly downloads
-
License
-
Repository
github
Last release
2 months ago

auth-form

a login/signup react component form, integrated with formik & yup for client-side authentication.

Setup

npm i auth-form-react

Live

Check it out here

How to use

import AuthForm from "auth-form-react";
import * as yup from "yup"; //if you wish to provide your own auth schema

function App() {
  const onLogin = (values) => {// dispatch form values to an API here};
  const onRegister = (values) => {// dispatch form values to an API here};
  return (
    <AuthForm
      onSignIn={onLogin}
      onSignUp={onRegister}
      validationSchema={yup.object({
        username: yup
          .string()
          .max(15, "Must be 15 characters or less")
          .required("Please provide a username"),
        email: yup
          .string()
          .email("Invalid email address")
          .required("Please provide an email"),
        password: yup
          .string()
          .max(9, "Must be 9 characters or less")
          .required("Please provide a password"),
      })}
      initalValues={{
        username: "",
        email: "",
        password: "",
      }}
    />
  );
}

export default App;
1.0.7

2 months ago

1.0.6

2 months ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago