What is the difference between HTML and React event handling?

In HTML, the attribute name is in all lowercase and is given a string invoking a function defined somewhere: In React, the attribute name is camelCase and are passed the function reference inside curly braces: In HTML, false can be returned to Continue reading What is the difference between HTML and React event handling?

What are defer and async attributes on a Script tag?

If neither attribute is present, the script is downloaded and executed synchronously, and will halt parsing of the document until it has finished executing (default behavior). Scripts are downloaded and executed in the order they are encountered. The defer attribute downloads the Continue reading What are defer and async attributes on a Script tag?

What does ‘use strict’ do and what are some of the key benefits to using it?

Including ‘use strict’ at the beginning of your JavaScript source file enables strict mode, which enforces more strict parsing and error handling of JavaScript code. It is considered a good practice and offers a lot of benefits, such as: Easier debugging due Continue reading What does ‘use strict’ do and what are some of the key benefits to using it?

How do you ensure methods have the correct this context in React component classes?

In JavaScript classes, the methods are not bound by default. This means that their this context can be changed (in the case of an event handler, to the element that is listening to the event) and will not refer to the component Continue reading How do you ensure methods have the correct this context in React component classes?