react-components Flashcards

1
Q

What is a React component?

A

React Component - It is a function or class that accepts an input and returns a React element. (which is markup)

Components are independent and reusable bits of code.

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

How do you define a component in React?

A

React component is a JavaScript function that you can sprinkle with markup. Here’s what that looks like (you can edit the example below):

export default function Profile() {
return (
<img></img>
)
}

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 (or “render” a component)?

A

when you run the app, it calls the render method on the reactDom object

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