import FormStatus from './FormStatus' ; import useApiFormWithValidation from './useApiFormWithValidation' ; function useOptimizedFormModel < T > ( getEntity , transform ) { const [ entity , , status ] = useApiFormWithValidation < T > ( getEntity , ( ) => '' , transform ) ; let flyingChanges = { } as Partial < T > ; const onPropChange = ( event ) => { if ( event . target ) { const { name , value } = event . target as any ; flyingChanges = { ... flyingChanges , [ name ] : value } ; } else { flyingChanges = { ... flyingChanges , ... event } ; } } ; return [ entity , onPropChange , status , ( ) => flyingChanges ] ; } export default useOptimizedFormModel ;