Next.js Discord

Discord Forum

Hydration error for edit link button

Unanswered
American Crocodile posted this in #help-forum
Open in Discord
American CrocodileOP
export default function EditStoryButton({ currentUserId, authorId, id }: Props) {
  if (currentUserId !== authorId) return null;
  return (
    <Link href={`/create-story/${id}/edit`}>Edit</Link>
  );
}

Error: Hydration failed because the initial UI does not match what was rendered on the server.
Warning: Expected server HTML to contain a matching <article> in <a>.
See more info here: https://nextjs.org/docs/messages/react-hydration-error


there is no <a> inside any article , its just a standart nextjs app i ve added this edit button link then error came, if i remove link error disappears

0 Replies