M3- Component hierarchy Flashcards

1
Q

What is the importance of planning an application as a series of components in React?

A

Planning an application as a series of components is essential because it helps you break down your UI into manageable, reusable pieces. Initially, this planning process can be tricky, but with practice, it becomes more intuitive. Components serve as the building blocks of your application, allowing you to structure and organize your code effectively.

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

How does React relate to core Internet technologies like HTML, CSS, and JavaScript?

A

React is a JavaScript library that builds on the core technologies of HTML, CSS, and JavaScript. While HTML provides the structure, CSS handles the styling, and JavaScript manages interactivity, React enhances JavaScript’s capabilities by allowing you to develop user interfaces more efficiently. It manages the state of your application and updates the UI dynamically.

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

What is a component hierarchy in React?

A

A component hierarchy in React refers to the structure where components are organized in a tree-like structure. Every React application starts with a root component, often called the app component. From this root, other components are added as child components, creating a hierarchy or tree of components that make up the entire application.

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

What is the benefit of reusing components in React?

A

Reusing components in React allows you to use the same piece of code in different parts of your application. This reusability makes your code more efficient, reduces repetition, and makes your application easier to maintain.

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

How would you break down a typical blog website into a component hierarchy?

A

A typical blog website might be broken down as follows:

  • App Component (Root): Represents the entire webpage.
  • Navbar Component: A child of the App component, containing the blog’s title, navigation links, and a search bar.
  • Page Component: Another child of the App component, containing the main content of the page.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the advantages of building a website with React components?

A
  • Reusability: Components can be reused across different parts of the application, reducing the need for repetitive code.
  • Maintainability: The modular nature of components makes your code easier to understand and maintain.
  • Efficiency: React allows you to develop user interfaces quickly and manage the dynamic behavior of your application more effectively.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly