Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

final-form-set-errors-mutator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

final-form-set-errors-mutator - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "final-form-set-errors-mutator",
"version": "1.0.0",
"version": "1.0.1",
"description": "Mutator for setting errors outside of form (for example in redux-saga)",

@@ -5,0 +5,0 @@ "contributors": [

# final-form-set-errors-mutator
Mutator for setting errors outside of form (for example in redux-saga)
# Installation
```bush
npm install final-form-set-errors-mutator
```
# How to use

@@ -12,3 +18,2 @@

import { setErrors } from "final-form-set-errors-mutator";
import { TextField } from "mui-fields";
import { ModelState } from "model-state-validation";

@@ -23,3 +28,3 @@

const MyForm: FunctionComponent<Props> = (props) => {
const [formApi, setFormApi] = useState<FormApi>(null);
const [ formApi, setFormApi ] = useState<FormApi>(null);

@@ -29,6 +34,6 @@ const formSubscription: FormSubscription = {

};
const [password, setPassword] = useState<string>("");
const [confirmPassword, setConfirmPassword] = useState<string>("");
const [ password, setPassword ] = useState<string>("");
const [ confirmPassword, setConfirmPassword ] = useState<string>("");
const handleChangePassword = (event: ChangeEvent<HTMLInputElement>) => {

@@ -51,3 +56,3 @@ const modelState = new ModelState();

modelState.addError(
"confirmPassword",
"confirm-password",
"Passwords are not equals."

@@ -74,14 +79,20 @@ );

<form onSubmit={handleSubmit}>
<Field
name={"password"}
component={TextField}
type="password"
onChange={handleChangePassword}
/>
<Field
name={"confirm-password"}
component={TextField}
type="password"
onChange={handleChangeConfirmPassword}
/>
<Field name="password">
{({ input, meta }) => (
<div>
<label>Password</label>
<input {...input} type="text" placeholder="Password" onChange={handleChangePassword}/>
{meta.error && meta.touched && <span>{meta.error}</span>}
</div>
)}
</Field>
<Field name="confirm-password">
{({ input, meta }) => (
<div>
<label>Confirm your password</label>
<input {...input} type="password" placeholder="Confirm password" onChange={handleChangeConfirmPassword}/>
{meta.error && meta.touched && <span>{meta.error}</span>}
</div>
)}
</Field>
</form>

@@ -95,3 +106,2 @@ );

export { MyForm };
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc