#Nextjs 13 - Create Button Component

3 messages · Page 1 of 1 (latest)

sacred crystal
#

Please can someone help me to create a Button component, because i got this error :
Event handlers cannot be passed to Client Component props.

// Button.jsx

function Button({
  onClick,
  text,
  type = "button",
}) {
  return (
    <>
        <button type={type} onClick={}>
          {text}
        </button>
    </>
  );
}
export default Button;

// Card.jsx

import Button from "./components/Button";

const Card = () => {
  const handleClick = () => {
    //
  }

  return (
    <Button text="Call now" onClick={handleClick} />
  );
};

export default Card;
bleak osprey
#

const Card = () => {
  const handleClick = () => {
    //
  }

  return (
    <Button text="Call now" onClick={handleClick} />
  );
};

export default Card;