0.0.25 • Published 5 years ago
@36node/redux-form v0.0.25
Redux form
Use
Config redux
import { formReducer } from "@36node/redux-form";
export default combineReducers({
forms: formReducer,
});
Actions
import { createFormActions } from "@36node/redux-form";
const formActions = createFormActions("someKey");
dispatch(formActions.reset());
// Actions:
interface FormActions {
// reset form with initialValues(Optional)
reset: (initialValues: Object, meta?: Object) => ResetAction;
// register field, note: once one name of field had registerred, repeat register action will be no effect
registerField: (name: String, meta?: Object) => RegisterFieldAction;
// register mutil fields, note: once one name of field had registerred, repeat register action will be no effect
registerMutilFields: (
fields: [{ name: String, initialValue: any }],
meta?: Object
) => RegisterMutilFieldsAction;
// change field state by name
changeField: (
name: String,
fieldState: {
name: String, //field name
dirty?: Boolean, // is dirty
touched?: Boolean, // is touched
value?: any, // field value
validating?: Boolean, // is validating
errors?: any, // validate errors
},
meta?: Object
) => SetAction;
// change mutil field state
changeMutilFields: (
fields: [
{
name: String, //field name
dirty?: Boolean, // is dirty
touched?: Boolean, // is touched
value?: any, // field value
validating?: Boolean, // is validating
errors?: any, // validate errors
},
],
meta?: Object
) => ChangeMutilFieldsAction;
}
selector
import { createFormSelector } from "@36node/redux-form";
const formSelector = createFormSelector("someKey"),
const state = formSelector(state);
// Form State:
interface FormState {
fields: {
[name: String]: {
name: String; //field name
dirty?: Boolean; // is dirty
touched?: Boolean; // is touched
value?: any; // field value
validating?: Boolean; // is validating
errors?: any; // validate errors
};
};
meta?: Object;
}
0.0.25
5 years ago
0.0.24
5 years ago
0.0.23
5 years ago
0.0.22
5 years ago
0.0.21
5 years ago
0.0.20
5 years ago
0.0.19
5 years ago
0.0.18
5 years ago
0.0.17
5 years ago
0.0.16
5 years ago
0.0.15
5 years ago
0.0.14
5 years ago
0.0.13
5 years ago
0.0.12
5 years ago
0.0.11
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.1
5 years ago