小编Has*_*hem的帖子

“这个悬念边界在完成水合之前收到了更新。” 在 Nextjs 中使用悬念和动态导入时出错

我正在尝试在 Nextjs 中延迟加载带有悬念和动态导入的数据列表。但出现以下错误:

Error: This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition.
Run Code Online (Sandbox Code Playgroud)

我尝试过使用 startTransition() 但不明白如何使用它。

数据列表.tsx:

Error: This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition.
Run Code Online (Sandbox Code Playgroud)

数据页.tsx

import React, { useState …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs next.js react-suspense

28
推荐指数
1
解决办法
2万
查看次数

在 React useState 钩子中删除数组的第一个元素?

我有这样的状态:

const [array, setArray] = useState([])
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用以下代码将项目添加到数组中:

setArray(oldArray => [...oldArray, item])
Run Code Online (Sandbox Code Playgroud)

如何删除此数组的第一个元素?

javascript arrays reactjs

5
推荐指数
2
解决办法
146
查看次数

标签 统计

javascript ×2

reactjs ×2

arrays ×1

next.js ×1

react-suspense ×1