For someone to look at this I will just share the parts of my code that I think is making these errors
I think there is an easy fix for the one who just knows if this is wrong or not,
But first of all, here is the error:
./app/(routes)/produkter/ny/page.tsx
26:41 Error: React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
*******More messages here of the same type*********
44:3 Error: React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
./app/(routes)/produkter/[...]/page.tsx
48:20 Error: React Hook "usePathname" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
*******More messages here of the same type*********
135:3 Error: React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
here is some code that I think is making errors during the build process:
if (value === "") {
return (
<div className="min-h-screen w-full flex flex-col items-center justify-center gap-8">
<div className="flex flex-col gap-4 items-center justify-center p-4 bg-[#222222] text-white rounded-md">
<Image
width={200}
height={200}
src={produkt?.bilder[0] || vercelImg}
/more code.... and then:/
if (value === "redigera") {
return (
<div className="p-4">
<div className="">
<Button
className="md:w-fit w-full"
variant="glowPrim"
onClick={() => {
So I have more of these ^^^^ but ofcourse I also have some useeffect hooks and usestate hooks further up in the code, I will share this code down below in the next message