hooks icon indicating copy to clipboard operation
hooks copied to clipboard

fix:cache useRequest tableProps value

Open nanianlisao opened this issue 4 years ago • 4 comments

之前每次渲染useRequest 都会返回一个新的tableProps 导致页面做无意义的渲染。缓存tableProps

nanianlisao avatar May 31 '21 08:05 nanianlisao

最简单的用法 <Table {...tableProps} />,你们业务里面会直接使用 tableProps 吗?

brickspert avatar Jun 01 '21 08:06 brickspert

最简单的用法 <Table {...tableProps} />,你们业务里面会直接使用 tableProps 吗?

使用,结合useMemo可以减少table的重新渲染

nanianlisao avatar Jun 01 '21 08:06 nanianlisao

最简单的用法 <Table {...tableProps} />,你们业务里面会直接使用 tableProps 吗?

使用,结合useMemo可以减少table的重新渲染

table 本身的渲染并不一定会减少,这取决于 table组件自身 是不是 PureComponent,只能说 假定 我们将 tableProps 传递给我们自己写的一个 PureComponent , 然后再转给 Table, 这种场景下确实可以减少渲染

ityuany avatar Jun 01 '21 09:06 ityuany

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jan 26 '22 02:01 CLAassistant