当前位置:网站首页>Differences and usage scenarios between usememo and usecallback
Differences and usage scenarios between usememo and usecallback
2022-07-21 20:37:00 【Lotus awn】
useMemo and useCallback The received parameters are the same
- The first parameter is callback
- The second parameter is the data to rely on
Work together :
Rely on data change , Will recalculate the result , That is, it plays the role of cache
Difference between them
- useMemo The result is return The value of coming back , It is mainly used for Cache the value of the calculation result , Application scenarios such as : need Calculated state
- useCallback The result is function , It is mainly used for Cache function , Application scenarios such as : Functions that need to be cached , Because functional components are any one at a time state The change of The whole assembly Will be refreshed , Some functions do not need to be refreshed , This should be cached , Improve performance , And reduce waste of resources .
边栏推荐
- 扫雷(C语言)
- Let the code solve the "linear algebra" series - polynomial summation
- 点击返回按钮,返回到之前的页面
- 矩阵求导常用公式(避坑)+矩阵的模和矩阵的绝对值的求导
- Click the back button to return to the previous page
- $.each的用法
- Luogu p1119 post disaster reconstruction (Floyd)
- MySQL import and export & View & Index & execution plan
- [c language] light rises in the dull days, the initial stage and the final battle
- 理解JS的三座大山
猜你喜欢
随机推荐
window. history. back(); The problem that layer cannot be closed after returning
js页面的跳转以及接收参数
Read the manuscript in pieces
Don't pull it today, don't pull it, read it in pieces
点击返回按钮,返回到之前的页面
useMemo和useCallback的区别以及使用场景
在ROS上跑高飞组代码遇到[global_planning_node-5] process has died [pid 3143, exit code -6, cmd /home/gaofei/ROS
The fifth Bureau, akali teaching Bureau
[c language] light rises in the dull days, the initial stage and the final battle
第五局 阿卡丽教学局 下
第五局 阿卡丽教学局 上半场数据分析
Acwing 175 circuit maintenance
Simpledateformat is used correctly
第四局 借问酒家何处有?牧童遥指杏花村 匹配几把 缓解对线压力 上
Available parameters are [list] error in batch upload
今天不拉扯了 不拉扯了 碎碎念 上
[C language] 0.5 times the speed to explain the interesting C language playing methods of the century war
Reset Form
How to get the second child element under the first child element
Read the manuscript in pieces