educative.io

Examples shown does not present the concept clearly

The first example failed because the function was not bound to the component with the bind method, not because the event was nullified after the event handler was executed. And the second example worked because we used the arrow function. Please correct me if I’m wrong.

Hi @Vishwambhara_Bhat,

Yes, the issue tacked in this lesson is to how to make use of the Event object out of the function as its scope is limited. In the second SPA, this problem was solved by using a state object literal whose scope extended outside the function.

I hope that answers your query.

I agree with Vishwambhara. I was able to make the first example work by simply changing line 7 to “handleChange = (e) =>”

e.target.value seems to retain its value and typing in the text box is replicated below. Perhaps that is just luck? If it is nullified, maybe that happens as part of some sort of garbage collection and this success is a matter of timing.