LFZ React Quiz 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

Elements are the smallest building blocks of React apps.

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

ReactDOM.render

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

What is JSX?

A

JSX produces React “elements”. Fundamentally, JSX just provides syntactic sugar for the React.createElement(component, props, …children)

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

Because JSK is just syntactic sugar for React objects

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

What is a React component?

A

Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.

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

How do you define a function component in React?

A

Just like a function in JS, except you return JSX. The name must start with a capital letter

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

How do you mount a component to the DOM?

A

With ReactDOM.render

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

What are props in React?

A

arguments passed into React components

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

How do you write JavaScript expressions in JSX?

A

With curly braces

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

How do you create “class” component in React?

A

by creating a new class that extends react.component

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

How do you access props in a class component?

A

With this.props

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

What is the purpose of state in React?

A

To update an element

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

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

A

provide a listener when the element is initially rendered.

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

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

A

id and type

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

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

A

value and onChange

17
Q

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

A

the map method

18
Q

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

A

The best way to pick a key is to use a string that uniquely identifies a list item among its siblings. Most often you would use IDs from your data as keys