React Structure Flashcards

1
Q

Why are these separated mean
1. import React from ‘react’
2. import ReactDOM from ‘react-dom/client’

A

The first line is for the react package and the second is for the view. Separation cause is that react can work with every view so replacing 2 with your view.

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

What do you need at the end of the file for your component to get displayed?

A

export App

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

Why was React invented by Facebook?

A

To decrease the amount of DOM manipulation which increaser development time, performance and bugs.

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

How does React improve the DOM problem?

A

By having its own virtual DOM (inside the render method of the component) that compare it with the DOM to see what changed and then changes the DOM.

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

What is JSX ?

A

It is an HTML-like language used in React to work with the virtual DOM.

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

How can I write JS expression in JSX?

A

Rap them in {}

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

What is the need for key in React arryas?

A

Less manipulation to the DOM. It tells react which card is which so in the case of removing or editing that card it will find it in the DOM and do what necessary.

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

What are pure components | deterministic |dumb components?

A

They return the same thing as long as they are given the same input

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

What are props?

A

Props are the information that you pass to a JSX tag.

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

What is state?

A

It is an object that describes your application. They hold the things that can change.

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

What is mounting?

A

Adding component to the screen.

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

When will the mounting methods get called?

A
  • Component creation
  • DOM insertion
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is updating?

A

It is caused by changes to props or state.

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

what is unmounting?

A

Removing component form the screen.

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

What is the render method job?

A

The render method should specify what you want to appear on the screen.

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

It is recommended to keep the render method pure, where should the side effects take place?

A
  • Event handlers
  • componentDidMount.
17
Q

What is the order of each component life cycle?

A

Check the diagram :
https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/

18
Q

What are component children?

A

They are JSX placed inside a JSX parent component, where they are represented as props in the parent.

19
Q

What is a script ?

A

List of comands excecuted by a prohram.