Working With Components, JSX and Props Flashcards

1
Q

How can we render the main component?

A

To render a main component we import react-dom. We can create a root using the createRoot method, which takes a DOM element as an argument. Once we have the root, we can call its render method to render the root component of our React app.

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

How can we enable strict mode?

A

We can also enable Strict Mode for our React app by wrapping our root component in a StrictMode component.

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

What does a strict mode do?

A

This helps identify potential problems by intentionally running certain lifecycle methods twice in development mode to highlight potential issues.

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

What is React made up of?

A

React apps are made up of components

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

What are the building blocks of user interfaces?

A

Components

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

What are components?

A

Components are a piece of UI that has its data, logic, and appearance ( how it works and looks )

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

How do we build complex UI?

A

We build complex UI using multiple components and combine them

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

What can be nested inside each other, reused, and passed data between them

A

Components

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

Tell me the component tree

A

The component tree is the hierarchy that exists between components. It shows how they relate to each other.

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

What is JSX?

A

JSX is a declarative syntax to describe what components look like and how they work. JSX is an extension of JavaScript that allows us to embed JavaScript, CSS, and React components into HTML-like syntax.

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

What transpiles JSX into JS?

A

Babel is a tool that transpiles JSX into JavaScript. Each JSX element is converted to a React.createElement function call.

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

What is imperative?

A

This approach involves directly interacting with the DOM API to update the UI, which can become complex and error-prone as the application grows in size and complexity.

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

What is declarative?

A

Being declarative means that we describe what the UI should look like based on the current data. React abstracts away from direct DOM manipulation; instead, it manages the DOM for us. We update the UI by updating the underlying data, and React automatically handles the rendering of components based on these updates.

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