Next.js Discord

Discord Forum

Button onClick is not firing

Unanswered
Yellow Warbler posted this in #help-forum
Open in Discord
Yellow WarblerOP
Hi, I have a custom button component (inspired by shadcn/ui):
//...variants and what not above 
export interface ButtonProps
  extends React.ButtonHTMLAttributes<HTMLButtonElement>,
    VariantProps<typeof buttonVariants> {}

export const Button: React.FC<ButtonProps> = ({
  className,
  variant,
  size,
  ...props
}) => {
  return (
    <button
      className={twMerge(buttonVariants({ variant, size }), className)}
      {...props}
    />
  );
};


And when called
 
<Button className="" onClick={() => signIn()}>
      Sign in with Google
    </Button>


The onClick does not do ANYTHING. I have tried console.log("clicked") and a seperate handler function, I have tried using the primitive <button> and onClick still does not work. The z-index is fine, as cursor events still work (hover, active)

1 Reply

Yellow WarblerOP
^ and yes it has "use client";