JS411 Some more on React

Will McClure
2 min readMar 10, 2021

What is the difference between state and props?

“props”, which is short for ‘properties’, are the first argument accepted by a React function. It is made up of arbitrary inputs dictated by the developer. Whereas “state” is data that changes throughout the length of an instance of a React component.

What is ReactDOM? What is the difference between ReactDOM and React?

ReactDOM provides specific methods on the DOM to enable efficient management of DOM elements, whereas React has tools intended to be shared by React on different platforms such as React Native.

What is React.createClass?

React traditionally provided React.createClass method to create component classes.

Explain event delegation in JavaScript and why it is useful.

Event delegation is comprised of distinct actions on event listeners. Event listeners are things that happen to HTML elements. A few examples of those are Mousover, Mouseout, and Keydown. A problem arises when elements are displayed on

The best explanation I have found for this is from Part 4: What is Event Delegation in JavaScript?

The whole idea behind event delegation is that instead of listening for a change on the inputs directly, we should look for an HTML element that is going to be on the page when the page initially loads.

It is best to think of event delegation as responsible parents and negligent children. The parents are basically gods, and the children have to listen to whatever the parents say. The beauty is if we add more children (more inputs), the parents stay the same — they were there from the beginning or, in other words, on page load.

--

--