Answers for "typescript onclick event type"

5

typescript onclick event type props

interface IProps_Square {
  message: string;
  onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
}
Posted by: Guest on July-11-2020
1

typescript onclick event type

import React from 'react';

type ButtonProps = {
  onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
}

const Button: React.FC<ButtonProps> = ({ children, onClick }) => {
  return (
    <button onClick={onClick}>
      {children}
    </button>
  );
}

export default Button;
Posted by: Guest on October-07-2021
3

react onclick typescript type

onClick={(event: React.MouseEvent<HTMLElement>) => {
 makeMove(ownMark, (event.target as any).index)
}}
Posted by: Guest on July-11-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language