This video is available to students only


This lesson provides a quick revision on some of the main topics behind developing UI applications with React.

📝 This lesson's quiz can be found - here. 🗒️ Solutions for this lesson's quiz can be found - here. 📖 This lesson's lecture slides can be found - here.

Though this course assumes some experience with the use of React, we're going to cover some of the core concepts of React in this lesson to bring everyone up to speed.

Traditional JavaScript#

In traditional HTML and JavaScript applications, JavaScript is used to directly manipulate the DOM (i.e. the Document Object Model). To make changes in our UI, we'd have to make references to the DOM and imperatively declare the changes we'd want.

For example, assume we had a simple <h2> element that said Hello World! and a button with an onclick listener that calls a changeGreeting() method when triggered.

Let's say we're interested in toggling the text content of the <h2> element when the button is clicked. To do so in native JavaScript, we have to get the reference to the DOM node in question and only then will we be able to change the text content of the DOM node.

Here's an example of toggling between the Hello World! and What is up! text when the Change Greeting button element is clicked.

This works fine but the problem a lot of engineers noticed with large-scale applications is things get difficult to track very quickly. Certain libraries came to the scene to help structure things better with the Model-View-Controller pattern or even the Model-View-Presenter pattern. React came into the scene with a pretty unique way of solving this.


React changed the paradigm of how we make changes to our UI with the help of something known as the virtual DOM. The virtual DOM is a cool term for essentially just JavaScript objects that represent the structure of the DOM.

When we make changes in React, we don't make changes directly to the actual DOM - we make changes to the virtual DOM. Why? Because it's a lot less expensive too. React then has the responsibility to compare the difference between the changes to the virtual DOM and the actual DOM, then patch the changes made to the actual DOM.

This has introduced a different way of building UI with React.


React gives us the ability to use JSX, a non-standard syntax which helps us create markup in JavaScript.

Here's an example of using the ReactDOM.render() function to render an element on a particular DOM node.

Start a new discussion. All notification go to the author.