react 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

objects you want to see on screen

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(whatYouWant, whereYouWantIt)

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

What is JSX?

A

a syntax extension that provides syntactic sugar 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

JSX only works React

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

uses babel loader and updates JSX to valid JS

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

What is a React component?

A

a function that accepts properties as an argument and returns a React element

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

function CapitalizedName (properties) { return Text Content

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

.render(ReactElem, domLocation)

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

What are props in React?

A

a special keyword in React used for passing data from one component to another

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

Component Name attribute=’value’

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

with curly braces around it

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

How do you create “class” component in React?

A

class CapitalizedName extends React.Component {
render() {return ReactElement}
}

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

How do you access props in a class component?

A

this.props

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

What is the purpose of state in React?

A

keep track of a component’s dynamic data that changes over time and determines the component’s behavior

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

as a prop={JS function} after the type inside the React Element

17
Q

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

A

.map

18
Q

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

A

a string that uniquely identifies a list item
ex: id