React Quiz Questions Flashcards

1
Q

What is React?

A

A JavaScript library for building user interfaces

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

What is a React element?

A

React elements are plain objects, and are cheap to create

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

How do you mount a React element to the DOM?

A

The render method of the ReactDom object

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

What is JSX?

A

A syntax extension to JavaScript

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

Why must the React object be imported when authoring JSX in a module?

A

So we can compile react and babel

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

How can you make Webpack and Babel work together to convert JSX into valid JavaScript?

A

You need the babel plugin-transform-react-jsx

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

What is a React component?

A

UI split into independent, reusable pieces

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

How do you define a function component in React?

A

Write a JavaScript function with an uppercase character to start

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

How do you mount a component to the DOM?

A

ReactDom render with the component passed as the tagName argument

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

What are props in React?

A

It is an object

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

How do you pass props to a component?

A

Putting a key value pair inside the component

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

How do you write JavaScript expressions in JSX?

A

By writing the expression within a set of curly braces

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

What Array method is commonly used to create a list of React elements?

A

The map method

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

What is the best value to use as a “key” prop when rendering lists?

A

A unique id within the dataset that was passed in

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

How do you create “class” component in React?

A

Extend the React.Component and declare a render method in the class

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

How to you pass an event handler to a React element?

A

A common pattern is for an event handler to be a method on the class

17
Q

What is the purpose of state in React?

A

The purpose is to track the change in state

18
Q

How to you pass an event handler to a React element?

A

By passing the event handler as a prop

19
Q

What are controlled components?

A

An input form element whose value is controlled by React

20
Q

What two props must you pass to an input for it to be “controlled”?

A

type and value