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.
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;
3
Q
How do you mount a component to the DOM?
A
ReactDOM.render