0.1.0 • Published 6 years ago

@cweise/redux-valacts v0.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

@cweise/redux-valacts

redux-valacts is a small companion library to create flux like redux-actions with a validation schema.

Install

npm i @cweise/redux-valacts yup --save
yarn add @cweise/redux-valacts yup

Usage

import { object, string } from "yup";
import { createAction } from "@cweise/redux-valacts";

const validationSchema = object({
  username: string().required(),
  password: string()
});

const login = createAction("LOGIN", { validationSchema });

// This will throw an error because username is required
login({
  username: "",
  password: "XXX"
});