我正在尝试在 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) 我有这样的状态:
const [array, setArray] = useState([])
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用以下代码将项目添加到数组中:
setArray(oldArray => [...oldArray, item])
Run Code Online (Sandbox Code Playgroud)
如何删除此数组的第一个元素?