What type is passed to functions from `onClick`?
Solution 1:
When you have a TS function that takes a callback, and you want to define the callback elsewhere but aren't sure of the right typing to use, first write the function inline with the callback, and use an IDE that can tell you the types of variables. Then look at the type of the variable:
Then copy that type when defining a standalone callback that you can pass in.
This works not only for onClick
in React, but for any situation where you're dealing with a callback you don't know the proper type for.