React Flashcards

1
Q

What is React?

A

React is an open-source front-end JavaScript framework that is used for building user interfaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the major features of React?

A
  1. Components: Components are the building blocks of any React application, and a single app usually consists of multiple components. It splits the user interface into independent, reusable parts that can be processed separately.
  2. Virtual DOM: React keeps a lightweight representation of the real DOM in the memory, and that is known as the virtual DOM.
  3. One-way data-binding: React’s one-way data binding keeps everything modular and fast. A unidirectional data flow means that when designing a React app, you often nest child components within parent components.
  4. High performance: React updates only those components that have changed, rather than updating all the components at once. This results in much faster web applications.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is JSX?

A

JSX is a syntax extension to JavaScript. It is used with React to describe what the user interface should look like. By using JSX, we can write HTML structures in the same file that contains JavaScript code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the difference between an element and component?

A

An Element is a plain object describing what you want to appear on the screen.

A component can be a class with a render() method or it can be defined as a function. In either case, it takes props as an input, and returns a JSX tree as the output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Can web browsers read JSX directly?

A

NO. This is because they are built to only read regular JS objects and JSX is not a regular JavaScript object. The file needs to be transformed into a regular JavaScript object. For this, we can use Babel for transpilation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the virtual DOM?

A

A virtual DOM is a lightweight JavaScript object which originally is just a copy of the real DOM. It is a node tree that lists the elements, their attributes and content as Objects and their properties. React’s render function creates a node tree out of the React components. It then updates this tree in response to the mutations in the data model which is caused by various actions done by the user or by the system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Difference between ES5 and ES6?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly