Skip to content

event.currentTarget is null #61

@aaronbeall

Description

@aaronbeall

When handling the onChange event the currentTarget is null.

You can see an example on webpackbin here:

<DebounceInput
  minLength={2}
  debounceTimeout={300}
  onChange={event => {
    console.log("target =", event.target);
    console.log("target.value =", event.target.value);
    console.log("currentTarget =", event.currentTarget);
   }} />

Which gives you the following output after typing "test":

target = <input type=​"text" value data-reactid=​".0.0">​
target.value = test
currentTarget = null

I take it this is because the event is stored then re-dispatched later, and React nulls out the currentTarget after the initial dispatch. However this is not what I would expect because its not how the event argument normally works, you expect currentTarget to be the target you added the handler to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions