Form 'fields' prop is too loosely coupled with form fields
#28.212 aberto em 4 de dez. de 2020
Métricas do repositório
- Stars
- (98.031 estrelas)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
If I pass down to the fields prop an empty array - form values do not change.
If I want, for example to set all fields to empty - I am forced to explicitly pass an array, describing each field that I want to be empty.
Repro: https://stackblitz.com/edit/react-v8yrzb?file=index.js
Press Reset form and you will see that Inputs' values do not change.
What does the proposed API look like?
I would like that if I pass [] to fields prop - all the fields in the corresponding form would become empty; because this is my intention.
Also, mind you, that that's exactly how setState works in React. You have your own strange version of it.
Please don't advise me to use form.resetFields - as I don't want the initial values - I want all fields to be empty. Also, I don't want use the form instance API.
Please don't advise not to use fields API - I have a very big and complex form and I want Redux to manage it.