-
-
Notifications
You must be signed in to change notification settings - Fork 136
[TEST ISSUE] Bug: useLocalStorage 在 SSR 环境下报错 #172
Copy link
Copy link
Open
Description
描述问题
在 Next.js 13 (App Router) 中使用 useLocalStorage hook 时,服务端渲染会抛出 localStorage is not defined 错误。
复现步骤
- 创建一个 Next.js 13 项目 (App Router)
- 安装
@reactuses/core - 在 Server Component 中使用:
'use client'
import { useLocalStorage } from '@reactuses/core'
export default function MyComponent() {
const [value, setValue] = useLocalStorage('my-key', 'default')
return <div>{value}</div>
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels