react-function-components Flashcards

1
Q

What is a React component?

A

reusable piece of UI that is created using JavaScript and the React JavaScript library. It can accept inputs (props) and return a tree of elements (virtual DOM) that describe how the component should render.

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

const ExampleComponent = (props) => {
return (
<div>
<h1>Hello {props.name}!</h1>
</div>
);
};

export default ExampleComponent;

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

ReactDOM.render

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