Gathering detailed insights and metrics for react-redux-easy-form
Gathering detailed insights and metrics for react-redux-easy-form
Gathering detailed insights and metrics for react-redux-easy-form
Gathering detailed insights and metrics for react-redux-easy-form
redux-react-form
A lightweight library that makes form validation easy with redux and validate.js
redux-form-validation-so-easy
Some useful validation rules for quick developing with redux-form.
vit-redux-form
Start building complex react-redux apps today, with this minimalist easy to understand starter kit (boilerplate)
@mithya-team/rte-quill-plugin
`rte-quill-plugin` is a plugin for integrating Quill rich text editor with your form library. It provides an easy-to-use interface for creating rich text content within forms handled by popular form libraries like React Hook Form, Formik, or Redux Form.
React-Redux Form manager, which performs into redux middleware and reduces rendering calls amount.
npm install react-redux-easy-form
Typescript
Module System
Node Version
NPM Version
TypeScript (91.07%)
JavaScript (8.45%)
HTML (0.48%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
3 Stars
87 Commits
1 Watchers
18 Branches
1 Contributors
Updated on Oct 13, 2022
Latest Version
2.0.0
Package Id
react-redux-easy-form@2.0.0
Unpacked Size
312.91 kB
Size
93.70 kB
File Count
55
NPM Version
8.19.1
Node Version
16.14.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
31
npm i react-redux-easy-form --save
You need react
, redux
, react-redux
, reselect
also to be installed.
1import { applyMiddleware, createStore, combineReducers } from 'redux'; 2import { easyFormMiddleware, easyFormReducer } from 'react-redux-easy-form'; 3 4const rootReducer = combineReducers({ 5 forms: easyFormReducer, 6 // ... your reducers 7}); 8 9const mws = applyMiddleware( 10 easyFormMiddleware, 11 // your middlewares 12); 13 14const store = createStore(rootReducer, {}, mws);
1import { FormProvider } from 'react-redux-easy-form'; 2// if use TS, the author will recommend to use enums for forms and fields naming 3import { EFormName } from '@src/root-enums'; 4 5const ProfileForm = memo(() => { 6 const dispatch = useDispatch(); 7 8 const initialValues = useSelector(getProfileFormInitialValues); 9 10 useEffect(() => { 11 dispatch(fetchInitialData()); 12 }, []); 13 14 return ( 15 <FormProvider 16 initialValues={initialValues} 17 name={EFormName.Profile} 18 > 19 <AgeField/> 20 <FullNameField /> 21 <GenderField /> 22 </FormProvider> 23 ); 24});
The fields will be bound with form name by React Context API.
Note: FormProvider does not create an element wrapper like form or kind. In this way FormProvider can be used in ReactDOM or ReactNative environment. If you need semantic wrapper, wrap the provider in form-element by yourself.
Note: Form component is deprecated since v2.0.0.
1import { IFieldConfig } from 'react-redux-easy-form'; 2 3const fieldConfig: IFieldConfig = { 4 changeValueGetter: (event) => event.target.value, 5 validateOnChange: true, 6 validators: [ 7 (value) => Number(value) > 99 ? 'Must be less than 100' : null, 8 ], 9};
Option Name | Option Type | Description |
---|---|---|
changeValueGetter | (event:any)=>any | A callback, that calls in onChange callback-prop, and transforms input argument into output result to set |
validateOnChange | boolean | A boolean flag, which decides to call fieldValidator on each onChange call to immediately receive validation result |
validators | TValidator[] | An array of TValidator functions, that validates the field separately. Each validation result will be set as separate element of output array |
1import { useField } from 'react-redux-easy-form'; 2 3const AgeField = memo(() => { 4 const { 5 errors, 6 onChange, 7 value, 8 } = useField<string>(EProfileFieldName.Age, fieldConfig); 9 10 return ( 11 <div> 12 <label htmlFor={EProfileFieldName.Age}> 13 Age (years) 14 </label> 15 <input 16 name={EProfileFieldName.Age} 17 onChange={onChange} 18 type="number" 19 value={value ?? ''} 20 /> 21 {errors && ( 22 <ul> 23 {errors.map((err: string) => ( 24 <li key={atob(err)} style={{ color: 'red' }}>{err}</li> 25 ))} 26 </ul> 27 )} 28 </div> 29 ); 30});
useField
hook returns an object of type TUseFieldSubscription
.
Name | Type | Description |
---|---|---|
clear | () => void | A callback, clearing the field value in redux-store |
errors | string[] , null | An array of field errors, provided after the validators called |
isFieldValid | boolean | A boolean value defines that field validation completed with no errors |
isPristine | boolean | A boolean value shows that field has had no changes |
onChange | (...callbackArgs: any[]) => void | A callback, changing value of an input in redux store |
validate | () => void | A callback, triggering the validation process of the field. For example, you can put it in onFocus, or onBlur props of your input |
value | any | Current value of the field in forms state of redux store |
changeValue(formName: string, fieldName: string, value: any): Action
Starts a middleware changing form field value. Field status becomes dirty.
changeValueAndValidate(formName: string, fieldName: string, value: any): Action
Starts a middleware changing form field value and immediately calls the validator on it.
clearValue(formName: string, fieldName: string): Action
Starts a middleware clearing the field value. Status becomes dirty.
validateAll(formName: string): Action
Starts a middleware launching all validators in the form.
validateField(formName: string, fieldName: string): Action
Starts a middleware launching all validators for the field.
clearFieldErrors(formName: string, fieldName: string): Action
Sets the field errors to null
clearFieldValue(formName: string, fieldName: string): Action
Sets the form field value to null
initiateForm(formName: string, initialValues: object): Action
setFieldErrors(formName: string, fieldName: string, errors: string[] | null): Action
Sets the field validation errors
setFieldStatus(formName: string, fieldName: string, status: EEasyFormFieldStatus): Action
Sets the field status
setFieldValue(formName: string, fieldName: string, value: any): Action
Sets the value into the form field
setFormErrors(formName: string, errors: string[] | null): Action
Sets the form errors
dropForm(formName: string): Action
Clears all values, keeps all initials, and sets all statuses to pristine
Returns forms state branch
createGetForm(formName: string): Selector
Returns the form state by the form name
createGetCommonFormErrors(formName: string): Selector
Returns the form errors (only common errors, except fields errors)
createGetFormAllFieldsErrors(formName: string): Selector
Returns the form fields errors (common form errors not included)
createGetFormErrors(formName: string): Selector
Returns all of the form validation errors
createGetIsFormValid(formName: string): Selector
Returns a boolean flag, whether the form is valid
createGetFormValues(formName: string): Selector
Returns values state branch of the form
createGetFormInitialValues(formState: string): Selector
Returns initials state branch of the form
createGetFormStatuses(formName: string): Selector
Returns statuses state branch of the form
createGetIsFormPristine(formName: string): Selector
Returns a boolean flag, whether all of the form fields are in pristine status
createGetFormFieldValue(formName: string, fieldName: string): Selector
Returns the form field value (from values state branch)
createGetFormFieldInitialValue(formName: string, fieldName: string): Selector
Returns the form field initial value (from initials state branch)
createGetFormFieldErrors(formName: string, fieldName: string): Selector
Returns the form field errors (from errors state branch)
createGetIsFormFieldValid(formName: string, fieldName: string): Selector
Returns a boolean flag of the validation result of the form field
createGetFormFieldStatus(formName: string, fieldName: string): Selector
Returns the form field status (from statuses state branch)
createGetIsFormFieldPristine(formName: string, fieldName: string): Selector
Returns a boolean flag, whether the form field is pristine
createGetFormFieldSafetyValue(formName: string, fieldName: string): Selector
Returns a calculated current value of the form field. The Calculation includes the set value, the initial value and the field status.
createGetFormSafetyValues(formName: string): Selector
An analogue of createGetFormFieldSafetyValue selector-creator, but returns all of the values of the form
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/22 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
55 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More