Ravenous: Part 3 - using event as an argument

https://www.codecademy.com/paths/build-web-apps-with-react/tracks/react-component-state/modules/ravenous-part-three/projects/setting-searchbar-state

I’m doing this project in VS code, and when I use ‘event’ as an argument as instructed it crosses it out and comes up with a ‘deprecated’ warning. Does anyone know why? Is event a keyword and has it been deprecated?

Here’s a screenshot: image

The event keyword is not deprecated. It might be something wrong in your codebase.

Thanks @eugenegoh. The error is coming from a library in VS Code (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.dom.d.ts)

/** @deprecated */
declare var event: Event | undefined;

But I guess I can ignore it if it works!

Consider trying out the solution here?

Might be the case that you’ve called Event (with a capital E) in the handleLocationChange which may be a reserved keyword or method that has a different meaning to what you intend.

The other thing is, you can actually call this parameter almost anything you like. Some people shorted to ‘e’ short for event. Basically you are initialising a local variable set to the value of what is passed to the event handler. As long as what is in the parenthesis is the same as what is then use within the event handler (i.e. calling it e, would then need to be e.target.value).