Next.js Discord

Discord Forum

Hydration errror

Unanswered
Munchkin posted this in #help-forum
Open in Discord
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 MainClientComponent

3 Replies