react-function-components Flashcards

1
Q

What is a React component?

A

A function or a class the returns React elements. Reusable. Used for a chunk of UI.

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

How do you define a function component in React?

A

By creating a function with a capital first letter that returns a React DOM element. In the return it is HTML that is converted to a React DOM element.

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

How do you mount a component to the DOM?

A
  1. Query the page for root
  2. Call createRoot on ReactDOM object and give it the queried root
  3. Call render on root object and give it a component
How well did you know this?
1
Not at all
2
3
4
5
Perfectly