Arrow syntax functions in React – React.js

This question is dealing with a step for the Animal Fun Facts project. (www.codecademy.com/courses/react-101/projects/js-react-animal-fun-facts) Specifically, for step 9, we must create a event handler function – {displayFact(e)} I originally defined this function with JS arrow syntax. The program failed to work, the fix was to convert to standard function syntax. Why is this the case? When are you allowed to use the arrow syntax in React?

In the below code snippet, the version of displayFact that is uncommented works, however the version that is commented our fails. Would appreciate an explanation!

Source link