import React from 'react'; import {Field, reduxForm} from '../../index'; import {getIn} from '../../utils/object-manager'; const validate = (values) => { const errors: MapMessages = {}; if (!values.lastName) { errors.lastName = 'Field required.'; } return errors; }; const warn = (values) => { const warnings: MapMessages = {}; if (values.lastName && values.lastName.length <= 2) { warnings.lastName = 'The minimum length of the value must be 2.'; } return warnings; }; const UnmountForm = (props) => { const {formState, handleSubmit} = props; return (
{getIn(formState, 'values.onlyForFront.noRequest.withLastName', false) ? (
) : null}
); }; export default reduxForm({ form: 'example', validate, warn, })(UnmountForm);