当前位置:网站首页>Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return
Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return
2022-07-18 16:52:00 【I'm Feng Feng Yi】
Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.
Error not caught : There are fewer rendered hooks than expected . This may be caused by an unexpected early return statement .
This mistake means react Some hook functions to be rendered in advance hook Returned without execution . The possible error codes are as follows
export default ()=>{
if(xxx) {
return xxx; // some hook Return before execution
}
useEffect(()=>{
xxx },[]);
useMemo(()=>{
xxx }, [])
return <div>xxx</div>
}
The solution is to move the return statement to all hook after
export default ()=>{
useEffect(()=>{
xxx },[]);
useMemo(()=>{
xxx }, [])
if(xxx) {
return xxx;
}
return <div>xxx</div>
}
边栏推荐
- (cf)Codeforces Round #807 (Div. 2)A--C思维题
- About network time protocol (NTP) mod-6 scanning vulnerability handling
- PGSQL中的limit n在sql语句中的位置
- Que se passe - t - il exactement de l'entrée d'URL à la présentation de page?
- 【深度学习】4 万字笔记!Yann LeCun 深度学习公开课 125 页干货都在这了
- 越来越难,不行就得多听几次
- Health prevention guide 2: healthy diet
- @Conditional conditional assembly
- 【VSCode】SyntaxError: Cannot use import statement outside a module
- [today's little go is going to throw away the garbage (1)]
猜你喜欢

One stop Devops platform makes a big difference in development

Bill Gates is about to withdraw from the world's rich list by donating $20billion!

Postgresql-14.4-源码阅读02-ReadBuffer_common-后续再更新此篇-看的头大

SAP Fiori Launchpad 上看不到任何 tile 应该怎么办?

在线SQL转YAML工具

历史上的今天:Mozilla 基金会正式成立;Enigma 密码机的首次工作;任天堂推出 FC 游戏机...

藏红花是否会成为用于关节炎患者的安全和有效的自然疗法?

考研人暑期行为大赏top5

The professional standard of the new profession "database operation administrator" was launched and developed

Postgresql-14.4-source code reading 02 readbuffer_ Common - update this post later - it's a big read
随机推荐
UWA report uses tips. Did you get it? (the fifth bullet)
String and memory functions
JVM architecture resolution
The latest version 0.3 of Infini console, which has been waiting for a long time, is officially released!
链表 - 【删除所有重复的元素】
Mongodb slow query and index
面试官:怎么不用定时任务实现关闭订单?
在创建生成WIFI二维码手机扫码链接
Modstart module pre release function is online
10张图教你同步与异步(转载)
《经济日报》点赞RPA领军企业弘玑,助力金融机构数字化转型
微信小程序下拉刷新功能--onPullDownRefresh
One stop Devops platform makes a big difference in development
查找——二叉排序树(二)
无996无内卷,乐视过上了“神仙日子”?
Database and the future of open source
ModStart模块预发布功能上线啦
【分享】二层交换和三层交换转发
[today's little go is going to throw away the garbage (3)]
SAP Fiori Launchpad 上看不到任何 tile 应该怎么办?