React: Add Event Listeners formatting

So the description of whats wanted in this challenge is written as:

Attach an event listener in the componentDidMount() method for keydown events and have these events trigger the callback handleKeyPress() . You can use document.addEventListener() which takes the event (in quotes) as the first argument and the callback as the second argument.

I can wrap my head around what they are asking for, but really have no idea how to put what they are asking for in code (this is happening more and more as these challenge progress, essentially zero discussion on formatting). How in the flying fuck, from that description, is a person suppose to deduce that document.addEventListener() is supposed to be formatted as

document.addEventListener(event, function, optional(useCapture)).

Oh, you highlighted “keydown” in the description? And (after finding out what keydown was via google since it was never mentioned before) I need to enter it as if it’s a prop with " " around it like it’s a string? Totally would have just guessed that. Why isn’t it this kind of thing ever brought up? I’ve always been good at math and finding solution to problems. Over and over again (especially towards the end of the javascript section) I can figure out how the problem should be solved, what methods would work for it, but I’m constantly just baffled as to how to put that in code, as essentially zero time goes into discussing how things need to be formatted (semi-colon at the end of this line? oops syntax error, separate these items with commas? syntax error).

Is every other code learning resource just as dysfunctional? You just hear over and over again how great FCC is…

I don’t want to make any assumptions, when you said you googled it, were you reading the MDN web docs? More specifically as it relates to JavaScript? You can find a list of events in the documentation.

target.addEventListener('yourEvent', function(), { capture: boolean});

There are further options available in the documentation, including syntax and examples.

If you’re needing further help with React, I would check in their documentation, their docs are pretty thorough. Otherwise, let me know and I’ll see if I can help.

I’m not really having tons of trouble finding solutions to the exercises. I just constantly have to look at outside sources to understand what’s going on. I feel that the lessons leave out necessary information often. Take for example ‘events’ in general. Their first real mention was in the lesson: Create a Controlled Input. BUT, did any lesson take time to actually explain what an event is? What its purpose is? Or did the lesson just say,

" First, create a method called handleChange() that has a parameter called event . When the method is called, it receives an event object that contains a string of text from the input element. You can access this string with event.target.value inside the method."

Its like, “here’s this thing that you use in your code, we aren’t goin to really tell you how it functions or what it’s purpose is, but I’m sure you’ll figure it out.”