JavaScript React Components React Component Patterns Refs and the DOM

Jonathan Kuhl
Jonathan Kuhl
26,129 Points

currentTarget.reset()?

I don't know if this is covered, but where does this line even come from?

event.currentTarget.reset();

I'm not sure where currentTarget.reset() is being defined. Is it a part of the React library?

Kjetil-Lennart A. Lorentzen
Kjetil-Lennart A. Lorentzen
13,387 Points
/* 
The currentTarget read-only property of the Event interface identifies the current target for the event, 
as the event traverses the DOM.
 It always refers to the element to which the event handler has been attached,
 as opposed to Event.target, 
which identifies the element on which the event occurred.
*/

https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget

1 Answer

Missy Kailet
Missy Kailet
4,012 Points

I'm not sure where currentTarget.reset() is being defined. Is it a part of the React library?

As Kjetil-Lennart l pointed out, that method comes from the Event API available in JavaScript. If you recall from the lecture, Guil mentioned that refs allow for "more traditional DOM manipulation" with vanilla JavaScript.