gpt4 book ai didi

reactjs - redux-form FieldArray 修改 props

转载 作者:行者123 更新时间:2023-12-03 14:27:10 24 4
gpt4 key购买 nike

我正在尝试找到一个用于我的表单的库,以处理验证和其他内容,我遇到了 redux-form,它似乎是最受欢迎的一个。

不过有一件事让我很困扰。在 FieldArray 示例中 https://redux-form.com/7.2.3/examples/fieldarrays/他们修改 props 以添加/删除字段。这实际上不是与函数式编程原则相冲突的反模式吗?

最佳答案

来自文档:https://redux-form.com/7.3.0/docs/api/fieldarray.md/

fields.push(value:Any) : Function

Adds a value to the end of the array. Returns nothing.

This is not a mutator; it dispatches an action which updates the state in Redux, which will cause your component to rerender.

关于reactjs - redux-form FieldArray 修改 props,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49158458/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com