andywer / andywer/use-inline-memo

Question: Can this library be used to memoize components inline?

未关闭
#18 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
164
派生
3
平均合并
17 小时 56 分钟
30 天内合并 PR
2

描述

Heya, nice project!

Just wanted to check if and how this library can be used to memoize components inline, e.g.:

```typescript
const Row = memo((props) => {
const { isLoadingRowAction, rowId } = props;

const thisLoadingRowAction = isLoadingRowAction === rowId;

return (
<>
{memo.circularFadeIn(


,
[thisLoadingRowAction]
)}

);
});
```

It appears that the component is one render behind, e.g. the CircularProgress doesn't fade in until the render **after** thisLoadingRowAction is `true` (even if it is false on the next render).

Any advice or guidance would be appreciated :)

Edit: Just did some logging:

![image](https://user-images.githubusercontent.com/5377480/154468463-e67b0ad3-32a9-43b9-8644-e263b3bd2dd9.png)

![image](https://user-images.githubusercontent.com/5377480/154468206-4fb81971-3928-4240-87ed-5af1f486a2c4.png)

Appears `in` is `true` in the second log but not in the first?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。