Hydration errror
Unanswered
Munchkin posted this in #help-forum
MunchkinOP
Not sure why this code is causing hydration? I'm using it in a similar way in other place and it doesn't.
'use client'
import React from 'react'
import { useRouter } from 'next/navigation';
import { useAccountStore } from '@/stores/useAccountStore'
const MainClientComponent = () => {
const route = useRouter()
const AccountInformation = useAccountStore(state => state)
const [username ] = React.useState(AccountInformation.User?.firstName)
return (
<div>
<p>
Welcome {username}
</p>
</div>
)
}
export default MainClientComponent3 Replies
MunchkinOP
Even by using the store down in the code would cause issue.
hydration error can be caused by a mismatch between what is prerendered in the server with what is hydrated on the client/browser