Proper type for an onClick event in React with Flow types

261 views Asked by At

I am trying to create a React component that has a property onClick and I am trying to determine the right type signature for the props of the component.

I have tried the following along with various modifications.

type Props = {
  label: string,
  onClick: ?func: (e: SyntheticMouseEvent<HTMLButtonElement>) => 
}

What is the proper type to accept for the onClick prop?

1

There are 1 answers

0
Schalton On

I'd add a typescript tag to this, but events are generally voids since they don't have a return void