the tableData array gets live data from firebase, when data is changed in db, the table gets updated like it should, but the problem is, CrudPanel is stuck with the data it rendered the first time.
the entire table gets updated but when you press buttons for edit it shows old record.
<tbody>
{this.state.tableData.map((rowdata, index) => {
return (
<tr key={index+1}>
<td style={{textAlign:'center'}}>{index+1}</td>
<td>{rowdata.key}</td>
<td>{rowdata.data.Fullname}</td>
<td>{rowdata.data.Phonenumber}</td>
<td>{rowdata.data.dateofbirth}</td>
<td><CrudPanel username={rowdata.key} record={rowdata.data}/></td>
</tr>
)
})}
</tbody>
Whenever a new record is inserted or a record is deleted,
- tableData is being updated successfully.
- table rows are getting re-rendered correctly, except the CrudPanel.
crud panel takes the takes the row data and renders two button insert, update, when pressed opens up a modal...
but the point is, it does not render crudPanel when the tableData is changing.
zz44 was the 13th record, i added "yoyo" so now 13th record is yoyo but if i pressed the edit button it show data of zz44, because it was the 13th record when page loaded first time.
the rowdata binds to the td is getting re-rendered but how and why does it leave CrudPanel untouched?
