Skip to content

Question: useEventCallback could take any callback signature besides SyntheticEvent? #14

Closed
@f0rr0

Description

@f0rr0

in the current implementation, it is assumed that useEventCallback will receive a react synthetic event. Is there any reason behind this assumption?

this does not let me use the callback on my custom event handlers.

For instance:

const MyInput = ({ onChange, value }) => (
   <input onChange={e => onChange(e.target.value)} value={value} />
)

I can't use useEventCallback on MyInput because the type signature of onChange there is:

type onChange = (val: string) => void

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions