I make a random number generator, and i wanted it to only work on the client side. so i added the 'use client' declaration on the first line. but the error is shown.
'use client'
import {create} from 'zustand'
import {nanoid} from "nanoid";
interface BearState {
bears: string
}
const useBearStore = create<BearState>()((set) => ({
bears: nanoid(),
}))
export function _Chat() {
const bearStore = useBearStore();
console.log("------", bearStore.bears)
return (
<div>
{bearStore.bears}
</div>
)
}
export default function Home() {
return (
<div>
<_Chat/>
</div>
)
}