react-function-components Flashcards

1
Q

What is a React component?

A

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 function component in React?

A
function Welcome(props) {
  return <h1>Hello, {props.name}</h1>;
}
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
const container = document.querySelector('#root');
const root = ReactDOM.createRoot(container);
root.render();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly