Next.js Discord

Discord Forum

Hydration issue with LastPass extension in Chrome

Answered
Asian black bear posted this in #help-forum
Open in Discord
Asian black bearOP
Hi! I am new in Next js/front dev.
Lately I got an error regarding hydration. I could not resolve it so I opened my project in Incognito mode. I found out that the issue is with LastPass extension. I could remove it, but it doesn't resolve my problem.
I have a component with a form and one input inside. I have tried a few solutions from stack overflow (data-lpignore="true" / autocomplete="off" / type="search"), but nothing worked for me.

Thanks in advance and have a nice day
Answered by Cape horse mackerel
go into your client component and add
'use client';
const YourComponent = () => {
const [mounted, setMounted] = useState(false);

useEffect(() => setMounted(true),[])

if(!mounted) return null;

return (...your html)
}
View full answer

2 Replies

Cape horse mackerel
go into your client component and add
'use client';
const YourComponent = () => {
const [mounted, setMounted] = useState(false);

useEffect(() => setMounted(true),[])

if(!mounted) return null;

return (...your html)
}
Answer
Asian black bearOP
It works, thanks a lot! Have a nice day