A table, can be modified for each tr. The modification is to pop up a
< Modal destroyOnClose modifyData= {data} / >
, and a Form in the
Modal. Here, use setFieldsValue
to backfill the form. Since Modal, is mounted when the page is initialized, componentDidMount ()
is only run once.
so I called this.props.form.setFieldsValue (this.props.modifyData)
in the componentWillReceiveProps (), shouldComponentUpdate (), render (), componentDidUpdate (),
lifecycle, respectively. The result of
running is that not only does the pop-up not open, it also creates an endless loop.
- Why does this happen? doesn"t the document say it will cause an endless loop in componentWillReceiveProps ()? Why do I do it in the rest of my life cycle?
- what is the idea of backfilling a form in this scenario using antd"s form. My understanding is that similar to VUE"s
watch
, I just need to know thatthis.props.modifyData
has changed, and then executesetFieldsValue
to dynamically change the value of the form. However, react doesn"t seem to have features likewatch
, so I have to use it during the lifecycle. (ps: found that turning modal, on and off triggers the life cycle of update.)
I don"t know if this understanding is correct