Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Components (2018) React Component Patterns Refs and the DOM

Jonathan Kuhl
Jonathan Kuhl
26,133 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,390 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,475 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.