LoginSignup
0
0

More than 3 years have passed since last update.

Typescrip 関数の型をpropsに渡す

Posted at

これがわかり安かったな

import * as React from 'react';

interface ToggleProps {
    ClickHandler: (event: React.MouseEvent<HTMLButtonElement>) => void
}

export function Toggle(Props: ToggleProps) {
    return <button onClick={Props.ClickHandler}>Toggle</button>
}

まとめ

色々調べてわかったのは下記

  • 公式 event: 大元イベント<エレメント>

  • イベントまとめ

    • FormEvent
    • HTMLElementEvent
    • MouseEvent
  • エレメントまとめ

    • InputElement
    • ButtonElement
    • HTMLFormElement

記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0