React performance in mobile browser

后端 未结 2 1538
萌比男神i
萌比男神i 2021-02-04 18:14

I have a component (table) that contains many lines with data editing in them, with masks in the form of contenteditable, it is possible to select all fields and ch

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 18:54

    You should override shouldComponentUpdate component life cycle method for every row of the table. Ideally for every cell in every row.

    If you have a table and it gets a different props. What happens is that every nested component gets re-rendered. PureComponents might help but writing shouldComponentUpdate is the only way to really control when something gets re-rendered.

    Also for really large data list there is a react-virtualized. Check it out. Its pretty cool.

    It would be nice if you could post source code though.

提交回复
热议问题