Open kettanaito opened 5 years ago
Field handlers that exist as Form methods now do not need to access the form (except of to pass the form reference as the form argument). They can be isolated into own functions.
form
// Form.jsx constructor() { + fromEvent('fieldChange').subscribe(handleFieldChange(this.eventEmitter, this)) } - handleFieldChange() {...} - handleFieldFocus() {...} - handleFieldBlur() {...}
Subscription example:.
// utils/subscriptions/handleFieldChange.js const handleFieldChange = (eventEmitter, form) = (eventPayload) => { const nextFieldState = foo(...) eventEmitter.emit('applyStatePatch', ..., ...) }
Why?
Field handlers that exist as Form methods now do not need to access the form (except of to pass the form reference as the
form
argument). They can be isolated into own functions.Subscription example:.