BlogPost_401

Cody Blair
2 min readMar 2, 2021

--

  1. Why/when would you use a class-based component vs a functional component?

Class based components will be your choice if you have an object with states, as this is unavailable to functional components, or if you want to take advantage of the built in life-cycle methods. Functional components are typically better practice, even though they have less built in functionality. They are easier to read, take less memory and are generally considered a better practice.

  1. What is create-react-app?

It is a package that either yarn or npm uses to install the react app.

  1. What are the differences between a class component and a functional component?

A lot of that is stated above. Class based components have state, as well as life cycle methods, are are built within the class syntax in javascript. Functional components are just functions that returns a react element.

  1. What is JSX?

JavaScript XML. It allows us to write html in react.

  1. How does React work?

React is a JavaScript library (not a framework) that creates user interfaces in a predictable and efficient way using declarative code.

  1. How does the virtual DOM work in React?

Where the regular DOM when updated has to re-render all of the child and parent nodes of the DOM. In comparison the virtual DOM compares which child nodes have been altered, and uses the built in functionality to find the quickest way to update by updating only the changed elements.

  1. Which (if there is) node library method could you use to solve the algorithm problem you solved last night in your pre-homework?

What?

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

A elements is an object, while a component is a function.

#ACA

--

--