JS 411 Just getting started

Will McClure
1 min readMar 10, 2021

Why would you use a class-based component vs a functional component?

Functional components generally result in less code and are plain JS functions without having to consider their state which makes them easier to read and test.

What’s the difference between an element and a component in React?

A React element describes a DOM node. It is immutable and no changes can be applied to it. An example is:

<button class=”myButton”></button>

A React component is a function or class that returns an element such as the one above. An example is:

const register = () => (

<div> <h1>Register Here</h1>

<button>Submit</button>

<button color=’blue’>Cancel</button>

</div>

);

What is create-react-app?

This package helps you quickly and efficiently setup a single-page React application.

What is JSX?

JSX allows HTML to be written in React.

How does the virtual DOM work in React?

It creates a virtual representation of the DOM, since frequent DOM manipulations require a large amount of performance. The virtual representation allows for comparisons between it and the real DOM and allows for batch updates to be sent to the user interface anytime there are changes.

--

--