Why are we able to use target as an object in the argument of a React handleChange function with object destructuring?

I’m curious about how a React handleChange(event) function can use object destructuring to use ({target}) as an argument like this (the bottom example):

Why can the target become an object? Any help would be greatly appreciated. Thanks!

These are – once again – Javascript basics, nothing React specific. event is an object and target is its property. And you can destructure properties of objects like this in Javascript – and therefore in React. And target doesn’t become an object – it is an object if the element that dispatched the event is one.
More about JS events can be found in the MDN docs

Related post:
https://discuss.codecademy.com/t/faq-the-state-hook-use-state-setter-outside-of-jsx/535825/6

1 Like