Replies: 2 comments 7 replies
-
Check |
Beta Was this translation helpful? Give feedback.
5 replies
-
可以用 getValueProps + getValueFromEvent 处理值的吞吐,参考 https://zhuanlan.zhihu.com/p/375753910 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
经常碰到的场景是
从后端获取到数据往往需要自己转换一次,
并且提交的时候还要从form收集到的值再转化为后端需要的值一次
如果这个form被多处地方使用,则会重复的编写转换逻辑,虽然我们可以把这个转换逻辑提取出来,
但是这个转换逻辑实际上与form的相关性高一点,应该和form放在一起,更加内聚一点。
这样就可以达到我填入的输入值,然后得到我想要的输出。
Frequently encountered scenarios are
Obtaining data from the backend often requires self conversion,
And when submitting, it is necessary to convert the values collected from the form into the values required by the backend once again
If this form is used in multiple places, the conversion logic will be repeatedly written, although we can extract the conversion logic,
However, this transformation logic is actually a bit more relevant to the form, and should be placed together with the form to be more cohesive.
This allows me to reach the input value I filled in, and then get the output I want.
Beta Was this translation helpful? Give feedback.
All reactions