Updating deep ReactJS state

前端 未结 2 1912
时光取名叫无心
时光取名叫无心 2021-01-11 19:24

I have an array of items in a ReactJS component state that I\'m iterating over to create a form. My question is: How do I best update those items when the fields change?

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-11 19:29

    Thought I'd just throw this library out there because it was specifically designed for deeply nested react state,

    https://github.com/mquan/cortex

    You can update items within each component and it automatically trickles up without you having to define callbacks to pass the event up.

提交回复
热议问题