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.
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>
)
}
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