React Animal Fun Facts Project

Hello Team,

So I need help with understanding the project below:
https://www.codecademy.com/courses/learn-react-introduction/projects/js-react-animal-fun-facts

I tried to upload the code to this topic, however I am getting 403 forbidden, hence you would need to reference the solution of the above project to review my below question:

So I need some help understanding how the function displayFact is being called in the images.push section. It seems I am trying to compare this with my knowledge of python and since the function has an input variable of e, I see when we add it to images.push it is called without the input variable (e), how does that work?

Hence if you have any other cool comments on the code solution to understand how it works you can add that too. Thanks team!

estands for ‘event’. It is only important to name the function parameter (you can call it whatever you like – most chose ‘e’ or ‘event’) in order to address it in the function body. But the event is automatically passed in as an argument when you have an ‘onClick’ event.

2 Likes

Ok, so that explains the input variable then, onclick itself is passed in as e. Thanks a lot!

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.