Last edited time
Mar 13, 2025 12:43 PM
type
status
date
summary
tags
password
URL
category
静态文件返回格式
注意如果你的静态文件是没有后缀的,nextjs将会无法判断文件格式,这种情况下你如果直接访问静态文件会自动下载。
需要在
next.config.ts中配置相关字段。比如基于public目录下的
/.well-known/apple-app-site-association文件就需要做如下处理。order of Hooks报错
React has detected a change in the order of Hooks called by LinkAI. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://react.dev/link/rules-of-hooks
如果遇到这个问题,需要注意你的界面代码中是否存在多个return,前面的return是否提前阻止了一些hooks的代码,这会导致后续代码无法执行从而报错。
解决方法
- 将return的不同情况放到代码最后部分
- 抽离出return另一种可能的逻辑到外层,将hooks统一放到内层。(推荐方式)
- 作者:七月
- 链接:https://huaqinda.com/article/166bbdbf-a033-8028-a147-dc61c966c87c
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。



