Installation
$ npm install redux-form-cc --save
$ yarn add redux-form-cc
Step 1 : Create Form Data
const formData = firstname: name: 'firstname' type: 'input' label: 'Firstname' value: stateformfirstname placeholder: 'write down your firstname' disabled: false rules: message: 'Required' value !== '' message: 'Please key "redux-form-cc"' value === 'redux-form-cc' lastname: name: 'lastname' type: 'input' label: 'Lastname' value: stateformlastname placeholder: 'write down your lastname' disabled: false ;
Step 2 : Create UI Input
const UIInputField = <div> <input ...fieldData onChange= /> fieldDatamessage </div>; const renderUIInputField = { return <UIInputField fieldData=fieldData onChange=onChange />;};
step 3 : Create Form action
Using with redux-thunk
const action = ;
Create Form with HOC
; const options = action formData renderUIInputField; const ComponentWithForm = Component;
Render Fields
The component will has form
and firstError
Component { const form firstError = thisprops; return <div> formfirstname formlastname firstError </div> ; }
Create Form with Hooks
; const options = action formData renderUIInputField; const Component = { const form firstError = ; return <div> formfirstname formlastname firstError </div> ;};