Next.js Discord

Discord Forum

Hydration Error

Answered
BigJHN posted this in #help-forum
Open in Discord
when i want use useState and i add 'use client'; on top of the component i have error
Answered by James4u
just try your app in guest mode without any extension
View full answer

14 Replies

'use client';
import { useState } from "react";

export default function Home() {
  const [click, setClick] = useState(0);
  const handleClick = () => {
    setClick(click + 1);
  }
  return (
    <div>
      <h1>Home</h1>
      <button onClick={handleClick}>Click me</button>
    </div>
  );
}
well, your code has nothing related to hydration error (if you shared your entired page)
just try your app in guest mode without any extension
Answer
@BigJHN
on other browser it working
thanks
yr welcome! mark solution to close the thread!
i cant
i dont have mark solution option
Original message was deleted
⬆️
@BigJHN
i dont have this option
@BigJHN i dont have this option
Right click -> Apps -> Mark Solution